Best Python code snippet using autotest_python
expansion.py
Source:expansion.py
...151 return len(self.queue) == 0152 def reservable(self, node: ReservationNode) -> bool:153 reservation = self.reservations.get(node)154 return reservation is None or reservation.agent == self.id155def postprocess_iteration(lvl: Level, paths: List[List[int]], debug: bool) -> List[List[int]]:156 """Makes agents trying to move into occupied vertices wait for another turn and resolve deadlocks."""157 reservations = ReservationGraph(lvl.g)158 agents: List[FlowAgent] = []159 for i, path in enumerate(paths):160 agents.append(FlowAgent(lvl, reservations, agents, i, path, debug))161 i = 0162 while any(map(lambda a: not a.done(), agents)):163 for agent in agents:164 agent.step()165 return [agent.path for agent in agents]166def postprocess_paths(lvl: Level, paths: List[List[int]], debug: bool) -> List[List[int]]:167 """Repeatedly postprocess deduplicated paths to get valid MAE paths shorter than from a single postprocess_iteration"""168 i = 1169 while True:170 if debug:171 print(f"Postprocessing iteration {i}", file=stderr)172 dedup = [list(map(lambda t: t[0], groupby(path))) for path in paths]173 new_paths = postprocess_iteration(lvl, dedup, debug)174 if debug:175 for j, path in enumerate(new_paths):176 print(f"{j}: {' '.join(map(str, path))}", file=stderr)177 if new_paths == paths:178 break179 paths = new_paths180 i += 1181 return paths182class Solution(NamedTuple):183 flow: int184 flow_dict: Dict185 node_ids: List[Tuple[Dict[int, int], Dict[int, int]]]186 t: int187def evacuation_paths(lvl: Level, debug) -> List[List[int]]:...
example.py
Source:example.py
...43 """44 super(example, self).run_once() # Prints out basic info45 # Do Something useful here, store results in 'stuff'46 self.stuff['dc'] = 'DockerCmd(...)'47 def postprocess_iteration(self):48 """49 Called to process each iteration of run_once()50 """51 super(example, self).postprocess_iteration() # Prints out basic info52 # Do Something useful here, check 'stuff' for iteration-errors53 self.stuff['postprocess_iteration'] = 'nobody ever uses this'54 def postprocess(self):55 """56 Called to process all results after all postprocess_iteration()'s57 """58 super(example, self).postprocess() # Prints out basic info59 # Do Something useful here, check 'stuff' for overall errors60 self.stuff['postprocess'] = 'this is where you check results'61 def cleanup(self):62 """63 Always called, after all other methods64 """65 super(example, self).cleanup() # Prints out basic info66 # Do Something useful here, leave environment as we received it...
ceph_dbench.py
Source:ceph_dbench.py
...19 tag=self.generate_tag_for_subjob(client_id=id_),20 )21 shutil.rmtree(client_dir)22 print 'ceph dbench test ok'23 def postprocess_iteration(self):24 for id_ in skeleton.roles_of_type(self.my_roles, 'client'):25 self.copy_subjob_results_kv(26 client_id=id_,27 subjob_name='dbench',...
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!