Best Python code snippet using autotest_python
Judge.py
Source: Judge.py
...100 def update_finished(self):101 for handle in list(self.active_agents):102 if (self.env.agents[handle].state == TrainState.DONE \103 or check_for_deadlock(handle, self.env, get_agent_positions(self.env))):104 self._finish_agent(handle)105 106 def _finish_agent(self, handle):107 self.active_agents.remove(handle)108 self.obs_builder._finish_agent(handle)109 110 def update_started(self):111 for agent in self.env.agents:112 if agent.handle not in list(self.active_agents):113 if (agent.state in self.valid_states):114 self._start_agent(agent.handle)115 116 def _start_agent(self, handle):117 self.active_agents.add(handle)118 self.obs_builder._start_agent(handle)119 def update_net_params(self, net_params):120 self.net.load_state_dict(net_params)121 def get_net_params(self, device=None):122 state_dict = self.net.state_dict()...
NetworkLoadAgentLauncher.py
Source: NetworkLoadAgentLauncher.py
...16 for handle in range(len(self.env.agents)):17 if (self.env.agents[handle].status == RailAgentStatus.DONE_REMOVED \18 or self.env.obs_builder.deadlock_checker.is_deadlocked(handle))\19 and self.ready_to_depart[handle] == 1:20 self._finish_agent(handle)21 while self.send_more > 0:22 best_handle = -123 for handle, agent in enumerate(self.env.agents):24 if self.ready_to_depart[handle] == 0 and \25 (best_handle == -1 or self.load[best_handle] > self.load[handle]):26 best_handle = handle27 if best_handle == -1:28 self.send_more -= 100000029 break30 self._start_agent(best_handle)31 def is_ready(self, handle):32 return self.ready_to_depart[handle] != 033 def _finish_agent(self, handle):34 self.send_more += 135 self.ready_to_depart[handle] = 236 self.load -= self.pairwise_load[handle]37 def _start_agent(self, handle):38 self.send_more -= 139 self.ready_to_depart[handle] = 140 self.load += self.pairwise_load[handle]41# can be optimized, i guess42def _calc_pairwise_load(env):43 n_agents = len(env.agents)44 pairwise_load = np.zeros((n_agents, n_agents), dtype=np.int)45 paths = [_build_shortest_path(env, handle) for handle in range(n_agents)]46 for i, j in itertools.combinations(range(n_agents), 2):47 pairwise_load[i, j] = pairwise_load[j, i] = len(paths[i] & paths[j])...
Check out the latest blogs from LambdaTest on this topic:
Before we discuss Scala testing, let us understand the fundamentals of Scala and how this programming language is a preferred choice for your development requirements.The popularity and usage of Scala are rapidly rising, evident by the ever-increasing open positions for Scala developers.
So, now that the first installment of this two fold article has been published (hence you might have an idea of what Agile Testing is not in my opinion), I’ve started feeling the pressure to explain what Agile Testing actually means to me.
Did you know that according to Statista, the number of smartphone users will reach 18.22 billion by 2025? Let’s face it, digital transformation is skyrocketing and will continue to do so. This swamps the mobile app development market with various options and gives rise to the need for the best mobile app testing tools
As a developer, checking the cross browser compatibility of your CSS properties is of utmost importance when building your website. I have often found myself excited to use a CSS feature only to discover that it’s still not supported on all browsers. Even if it is supported, the feature might be experimental and not work consistently across all browsers. Ask any front-end developer about using a CSS feature whose support is still in the experimental phase in most prominent web browsers. ????
The count of mobile users is on a steep rise. According to the research, by 2025, it is expected to reach 7.49 billion users worldwide. 70% of all US digital media time comes from mobile apps, and to your surprise, the average smartphone owner uses ten apps per day and 30 apps each month.
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!!