How to use get_info_lines method in autotest

Best Python code snippet using autotest_python

savefile.py

Source:savefile.py Github

copy

Full Screen

...41 # put network on CPU, so that it can also be opened and read on computers without a GPU42 with open(path + filename + '.save', 'wb') as file:43 pickle.dump(savefile, file)44 with open(path + 'info.txt', 'w') as info:45 info.writelines(get_info_lines(savefile))46 47def make_folder(savefile):48 path = PATH + savefile.version + '/'49 if not os.path.exists(path):50 try: os.mkdir(path)51 except OSError: print(f'Failed creating folder {path}')52 else: print(f'Successfully created folder {path}')53def load_from_disk(version):54 path = PATH + version + '/'55 files = [f for f in os.listdir(path) if '.save' in f]56 files.sort(reverse = True)57 if len(files) < 1:58 print(f'nothing to load from directory {version}/')59 exit(0)60 with open(path + files[0], 'rb') as file:61 return pickle.load(file)62def get_info_lines(savefile):63 path = PATH + savefile.version + '/'64 txt = [f'date: {datetime.datetime.now()}']65 txt.append(f'\nsimulations: {savefile.config.num_iterations}')66 txt.append(f'\nboard_size: {savefile.config.size}x{savefile.config.size}')67 txt.append(f'\nconvolutional filters: {savefile.config.num_conv_filters}')68 txt.append(f'\nresidual blocks: {savefile.config.num_res_blocks}')69 txt.append(f'\nlearning rate: {savefile.config.learning_rate}')70 txt.append(f'\ngames between training: {savefile.config.num_actors}')71 txt.append(f'\nepochs between games: {savefile.config.epochs_between_games}')72 txt.append(f'\ngame window size: {savefile.config.window_size}')73 txt.append(f'\nbatch size: {savefile.config.batch_size}')74 txt.append(f'\n\ntime elapsed: {datetime.timedelta(seconds = savefile.time_spent)} ({savefile.time_spent:.0f} seconds)')75 txt.append(f'\ngames played: {savefile.num_games_played}')76 txt.append(f'\nepochs trained: {savefile.num_epochs_trained}')...

Full Screen

Full Screen

radiance_command_getinfo_test.py

Source:radiance_command_getinfo_test.py Github

copy

Full Screen

1import unittest2from honeybee_plus.radiance.command.getinfo import Getinfo3import os4import tempfile5class GetinfoTestCase(unittest.TestCase):6 """Test for (honeybee/radiance/command/oconv.py)."""7 # preparing to test8 def setUp(self):9 """Set up the test case by initiating the class."""10 get_info = Getinfo()11 get_info.input_file = os.path.abspath('tests/assets/sample.hdr')12 get_info.output_file = os.path.abspath(tempfile.mktemp(suffix='.txt'))13 self.getinfo_test1 = get_info14 self.output_file1 = get_info.output_file15 # ending the test16 def tearDown(self):17 """Cleaning up after the test."""18 pass19 # test default values20 def test_default_values(self):21 """The first test checks if Getinfo works. The script opens an image22 assets/sample.hdr and reads its header."""23 self.getinfo_test1.execute()24 with open(self.output_file1.to_rad_string()) as some_file:25 get_info_lines = some_file.readlines()[1].strip().split()[0]26 assert get_info_lines == '#?RADIANCE'27if __name__ == '__main__':28 # You can run the test module from the root folder by running runtestunits.py29 os.chdir(os.pardir)...

Full Screen

Full Screen

convert_log.py

Source:convert_log.py Github

copy

Full Screen

1# class Logdocument:2# def __init__(self):3# index = 04# buffer = ""5# def get_info_lines(self, log_file: str) -> list[str]: #list = return type6# INFO_LINES=[]7# with open(log_file, 'r') as f:8# for line in f:9# if 'INFO' in line:10# INFO_LINES.append(line)11# return INFO_LINES12# def parse_devkey(self, line: str) -> int: #int = return type13# index = line.index("devkey_handle")14# buffer = line[index + 16:]15# return int(buffer.split("}")[0])16# def parse_addrehandle(self, line: str) -> int: #int = return type17# index = line.index("address_handle")18# buffer = line[index + 16:] 19# return int(buffer.split("}")[0])20# def main(self):21# lines = get_info_lines('log\COM12_21-347-22-51_output.log')22# for line in lines:23# if 'devkey_handle' in line: #zit devkey_handle in die line24# print(f'Devkey: {parse_devkey(line)}') #print de nummer van devkey25# elif 'address_handle' in line:26# print(f'address_handle: {parse_addrehandle(line)}')27#if __name__ == '__main__':28 # Logdocument()29 # main()...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run autotest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful