Best Python code snippet using avocado_python
job.py
Source:job.py
...39 info("Updating RSS file")40 update_rss(show, basename(tmp_file), file_size)41 except ApolloException as apollo_exception:42 error(f"Error encountered: {apollo_exception}")43def _run_proc(show: Show) -> None:44 Process(target=_job, args=(show,)).start()45def schedule_show(show: Show) -> None:46 """Schedules a show based on the day of week and start time"""47 if "monday" in show.days:48 every().monday.at(show.start_time).do(_run_proc, show=show)49 if "tuesday" in show.days:50 every().tuesday.at(show.start_time).do(_run_proc, show=show)51 if "wednesday" in show.days:52 every().wednesday.at(show.start_time).do(_run_proc, show=show)53 if "thursday" in show.days:54 every().thursday.at(show.start_time).do(_run_proc, show=show)55 if "friday" in show.days:56 every().friday.at(show.start_time).do(_run_proc, show=show)57 if "saturday" in show.days:...
mount.py
Source:mount.py
...12 if not bitmask & 1:13 free_drives.append(letter+":")14 bitmask >>= 115 return free_drives16def _run_proc(args):17 suinfo = subprocess.STARTUPINFO() #TODO: suinfo is windows only18 suinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW 19 suinfo.wShowWindow = subprocess.SW_HIDE #hides console window20 p = subprocess.Popen(args, startupinfo=suinfo)21 return p22#TODO: add function to get stdout\stderr from subprocess for more info in case of errors23def mount(key, secret, bucket, mountpoint):24 #setting env for new proc25 os.environ["AWS_ACCESS_KEY_ID"] = str(key)26 os.environ["AWS_SECRET_ACCESS_KEY"] = str(secret)27 bucket_url = "s3://"+bucket28 fs_parms = [bucket_url , mountpoint, '--log' , 'fs.log' , '--debug' ,29 ,'--cache-path', os.getenv('TEMP',os.getcwd())+"/yas3fs-cache"30 ,'--uid', '545'] #uid 545 means 'all users'31 #TODO: set uid that maps to the current user sid32 #for rules see https://github.com/billziss-gh/winfsp/blob/9bd9cf4fbd42c1c0d0c50666df403df3d3381c43/src/dll/posix.c#L120 33 if getattr( sys, 'frozen', False ) :34 # running in a bundle , we exec the same module35 p = _run_proc([sys.executable , "YAFS"] + fs_parms)36 else:37 # running live38 python_path = sys.executable39 p = _run_proc([python_path , "-m" , "yas3fs.__init__"] + fs_parms)40 return {"process" : p , "mountpoint" : mountpoint}41def mount_alive(mount_obj):42 if mount_obj["process"].poll() != None:43 return False44 if os.path.exists(mount_obj["mountpoint"]) == False:45 return False46 #TODO: On Linux also check return os.path.ismount(mount_obj["mountpoint"])47 return True48def unmount(mount_obj):49 parent = psutil.Process(mount_obj["process"].pid)50 for child in parent.children(recursive=True): 51 child.kill()...
prepare_kaldi_data.py
Source:prepare_kaldi_data.py
...16 try:17 os.makedirs(d)18 except OSError:19 pass20def _run_proc(cmd):21 p = subprocess.Popen(cmd, stdout=subprocess.PIPE)22 if p.wait() != 0:23 raise RuntimeError("Non-zero (%d) return code for `%s`" % (p.returncode, " ".join(cmd)))24def main(wav_scp, feat_ark, feat_scp, len_scp, fbank_conf):25 KALDI_ROOT = _get_kaldi_root()26 _maybe_makedir(os.path.dirname(feat_ark))27 _maybe_makedir(os.path.dirname(feat_scp))28 _maybe_makedir(os.path.dirname(len_scp))29 cmd = [os.path.join(KALDI_ROOT, "src/featbin/compute-fbank-feats")]30 cmd += ["--config=%s" % fbank_conf]31 cmd += ["scp,p:%s" % wav_scp, "ark,scp:%s,%s" % (feat_ark, feat_scp)]32 _run_proc(cmd)33 34 cmd = [os.path.join(KALDI_ROOT, "src/featbin/feat-to-len")]35 cmd += ["scp:%s" % feat_scp, "ark,t:%s" % len_scp]36 _run_proc(cmd)37if __name__ == "__main__":38 parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)39 parser.add_argument("wav_scp", type=str, help="input wav scp file")40 parser.add_argument("feat_ark", type=str, help="output feats.ark file")41 parser.add_argument("feat_scp", type=str, help="output feats.scp file")42 parser.add_argument("len_scp", type=str, help="output len.scp file")43 parser.add_argument("--fbank_conf", type=str, default="./misc/fbank.conf",44 help="kaldi fbank configuration")45 args = parser.parse_args()46 print args...
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!!