How to use reset_runtime method in Behave

Best Python code snippet using behave

interpreter.py

Source:interpreter.py Github

copy

Full Screen

...594 def list_cells(self):595 nodes, _, edge_names = self.graph.get_all_cells_edges()596 print("Cells:", nodes)597 print("Edges:", edge_names)598 def reset_runtime(self):599 # Delete all runtime variables600 with self.lock:601 global exec_vars602 exec_vars = {}603 def reset_graph(self, ask=True):604 if ask:605 confirm = input(606 "Are you sure you want to reset the graph? This will delete all nodes and variables. (y/n) ")607 if "y" in confirm:608 self.graph = Graph(self)609 self.reset_runtime()610 self.std_capture = StringIO()611 else:612 self.graph = Graph(self)613 self.reset_runtime()614 self.std_capture = StringIO()615 def save_graph(self, command):616 """:param command: command to be executed."""617 if len(command) != 2:618 print("save takes 1 argument1: [filename]")619 return620 output_text = ""621 if command[1].lower().endswith(".satx"):622 output_text = self.graph.get_satx_as_txt()623 elif command[1].lower().endswith(".py"):624 output_text = self.graph.get_py_file()625 elif command[1].lower().endswith(".ipynb"):626 output_text = self.graph.get_ipynb_file()627 with open(command[1], "w+") as file:628 file.write(output_text)629 def command_switch(self, command):630 if len(command) == 0:631 return632 elif command[0] == "help":633 print(self.help_menu())634 elif command[0] == "quit":635 return "break"636 elif command[0] == "cell":637 self.create_cell(command)638 elif command[0] == "edit":639 self.edit_cell(command)640 elif command[0] == "rename":641 self.rename_cell(command)642 elif command[0] == "remove":643 self.remove_cell(command)644 elif command[0] == "link":645 self.link(command)646 elif command[0] == "sever":647 self.sever(command)648 elif command[0] == "merge":649 self.merge(command)650 elif command[0] == "swap":651 self.swap(command)652 elif command[0] == "execute":653 self.execute(command)654 elif command[0] == "display":655 self.display(command)656 elif command[0] == "list":657 self.list_cells()658 elif command[0] == "reset_runtime":659 self.reset_runtime()660 elif command[0] == "reset_graph":661 self.reset_graph()662 elif command[0] == "save":663 self.save_graph(command)664 elif ".satx" in command[0]:665 self.run_file(command)666 elif len(command[0]) > 0:667 print("Syntax error: command \"" + command[0] + "\" not recognized.")668 def run(self):669 # Main application loop670 while True:671 command = self.read_input()672 if self.command_switch(command) == "break":673 break

Full Screen

Full Screen

model_library.py

Source:model_library.py Github

copy

Full Screen

...302 def is_file(self):303 return self.__dict_writer.file_exists304 def add_runtime(self, runtime: float):305 self.data['total_runtime'] += runtime306 def reset_runtime(self):307 self.data['total_runtime'] = 0308 @property309 def runtime(self):310 return self.data['total_runtime']311 def save(self) -> None:312 self.__dict_writer.save(self.data)313 return None314 def load(self) -> dict:315 return self.__dict_writer.load()316class EntailmentSelfAttention(nn.Module):317 """ Implementation Code MODIFIED from: https://www.youtube.com/watch?v=U0s0f995w14&t=2494s,318 From paper: https://proceedings.neurips.cc/paper/2017/file/3f5ee243547dee91fbd053c1c4a845aa-Paper.pdf"""319 def __init__(self, embed_size: int, heads: int):320 super(EntailmentSelfAttention, self).__init__()...

Full Screen

Full Screen

runner_util.py

Source:runner_util.py Github

copy

Full Screen

...341 from behave.formatter.ansi_escapes import escapes342 msg = escapes['undefined'] + msg + escapes['reset']343 stream.write(msg)344 stream.flush()345def reset_runtime():346 """Reset runtime environment.347 Best effort to reset module data to initial state.348 """349 from behave import step_registry350 from behave import matchers351 # -- RESET 1: behave.step_registry352 step_registry.registry = step_registry.StepRegistry()353 step_registry.setup_step_decorators(None, step_registry.registry)354 # -- RESET 2: behave.matchers355 matchers.ParseMatcher.custom_types = {}...

Full Screen

Full Screen

algorithmtester.py

Source:algorithmtester.py Github

copy

Full Screen

...209 self.Algorithm = algorithm210 # initialize runtime211 self.r = None212 self.Data = None213 self.reset_runtime(0, len(data))214 def __str__(self):215 """216 :return: a string explaining the info of the tester object217 """218 return "Tester object on %d blocks with algorithm %s".format(len(self.Data), str(self.Algorithm))219 def test_range(self, range_size):220 """221 Tests all ranges of size range_size and for each such range yields a tuple like:222 (cost, reward, R/C%, R/C% lowest, R/C% highest)223 :param range_size: the size of slice of all data to take in each test224 :return: a tuple as (cost, reward, R/C%, R/C% lowest, R/C% highest)225 """226 for i in range(len(self.AllData) - range_size):227 self.reset_runtime(i, i + range_size)228 self.prepare_to_run()229 run_results = self.run()230 yield run_results231 def reset_runtime(self, start, end):232 """233 :param start: runtime starting index in all data234 :param end: runtime ending index in all data235 :return:236 """237 self.r = Runtime(start, end)238 self.Data = self.AllData[start:end]239 def run(self):240 """241 Executes the ticks one by one from the beginning until the end242 :return:243 """244 logger_object = logger("tester")245 # pre tick...

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 Behave 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