Best Python code snippet using lisa_python
state.py
Source: state.py
...50 sys.exit(1)51 [path] = paths52 if 'saves' not in path.parts:53 savefile = 'autosave.'+str(max([int(x.name.split('.')[1])54 for x in (get_datetime_path(path) / 'saves').glob('autosave.*')]))55 path = get_datetime_path(path) / 'saves' / savefile56 57 assert all(['=' in arg for arg in sys.argv[1:]])58 overrides = [arg.split('=')[0] for arg in sys.argv[1:]]59 device = None60 if 'device' in overrides:61 device=cfg.device # override the device62 mlb.green(f"loading from {path}...")63 self.load(path, device=device)64 #mlb.purple(f"It looks like the device of the model is {self.phead.output[0].weight.device}")65 if cfg.mode == 'device':66 mlb.green(f"DEVICE: {self.cfg.device}")67 print("loaded")68 print_overrides = []69 for override in overrides:...
util.py
Source: util.py
...37 In: plots/x.png38 Out: 12-31-20/12-23-23/plots/x.png39 """40 return outputs_path(p).relative_to(outputs_path(''))41def get_datetime_path(p):42 """43 Path -> Path44 In: .../2020-09-14/23-31-49/t3_reverse.no_ablations_first45 Out: .../2020-09-14/23-31-4946 Harmless on shorter paths47 """48 idx = p.parts.index('outputs')+3 # points one beyond TIME dir49 return pathlib.Path(*p.parts[:idx]) # only .../DATE/TIME dir50def get_datetime_paths(paths):51 return [get_datetime_path(p) for p in paths]52def outputs_regex(*rs):53 """54 The union of one or more regexes over the outputs/ directory.55 Returns a list of results (pathlib.Path objects)56 """57 res = []58 for r in rs:59 r = r.strip()60 if r == '':61 continue # use "*" instead for this case please. I want to filter out '' bc its easy to accidentally include it in a generated list of regexes62 try:63 r = f'**/*{r}'64 res.extend(list(outputs_path('').glob(r)))65 except ValueError as e:...
cmd.py
Source: cmd.py
...33 if len(results) == 0:34 print('[No matching files]')35 continue36 for result in results:37 print(f"{result} -- implies -> {get_datetime_path(result)}")38 try:39 yes = input('Type `y` to confirm deletion of the above results:').strip()40 except (EOFError,KeyboardInterrupt):41 continue42 if yes != 'y':43 print("aborting...")44 continue45 for result in results:46 result = get_datetime_path(result)47 target_parent = toplevel_path('outputs_trash') / result.parent.name # result.parent.name is DATE/48 target_parent.mkdir(parents=True,exist_ok=True) 49 result.rename(target_parent / result.name)50 print(f'moved {result} -> {target_parent / result.name}')51 return52def process(tb):53 """54 Process a tensorboard directory to get all its events. Doesn't work recursively from higher directories (that wouldnt really make sense)55 """56 try:57 tboard = EventAccumulator(tb)58 except Exception as e:59 print("unable to load file {tb}: {e}")60 return...
Check out the latest blogs from LambdaTest on this topic:
Automating testing is a crucial step in the development pipeline of a software product. In an agile development environment, where there is continuous development, deployment, and maintenance of software products, automation testing ensures that the end software products delivered are error-free.
Before we discuss the Joomla testing, let us understand the fundamentals of Joomla and how this content management system allows you to create and maintain web-based applications or websites without having to write and implement complex coding requirements.
The QA testing career includes following an often long, winding road filled with fun, chaos, challenges, and complexity. Financially, the spectrum is broad and influenced by location, company type, company size, and the QA tester’s experience level. QA testing is a profitable, enjoyable, and thriving career choice.
It’s strange to hear someone declare, “This can’t be tested.” In reply, I contend that everything can be tested. However, one must be pleased with the outcome of testing, which might include failure, financial loss, or personal injury. Could anything be tested when a claim is made with this understanding?
When it comes to UI components, there are two versatile methods that we can use to build it for your website: either we can use prebuilt components from a well-known library or framework, or we can develop our UI components from scratch.
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!!