How to use path_to_generated method in tox

Best Python code snippet using tox_python

bench.py

Source:bench.py Github

copy

Full Screen

1import os2import re3import subprocess4import sys5import time6# RUN = "iccma19"7RUN = "gen"8RESULTS = f"results_{RUN}"9TIMEDOUT = "TIMEDOUT"10COMPLETE = "cmp"11PREFERRED = "prf"12STABLE = "stb"13SEMANTICS = (COMPLETE, PREFERRED, STABLE)14s_to_ac = {15 COMPLETE: "cmp",16 PREFERRED: "prf",17 STABLE: "stb"18}19s_to_m = {20 COMPLETE: "EE-CO",21 PREFERRED: "EE-PR",22 STABLE: "EE-ST"23}24def bench_one(cmd, out, timeout, overwrite=False):25 if not overwrite and os.path.isfile(out):26 print(f"file {out} already exists and cannot be overwritten")27 return28 with open(out, "w+") as f:29 try:30 start = time.time_ns()31 subprocess.run(cmd, stdout=f, timeout=timeout)32 end = time.time_ns()33 except subprocess.TimeoutExpired as t:34 f.write('\n')35 f.write(TIMEDOUT)36 else:37 f.write('\n')38 f.write(str(end - start))39 f.write('\n')40def bench_aaf_cadical(path_to_aaf_cadical, filename, stub, semantic, timeout, overwrite, results):41 bench_one(cmd=(os.path.join(path_to_aaf_cadical, "bin", f"aaf-{s_to_ac[semantic]}.exe"), filename),42 out=os.path.join(path_to_aaf_cadical, results, f"{stub}.{semantic}"),43 timeout=timeout,44 overwrite=overwrite)45def bench_mutoksia(path_to_mutoksia, filename, stub, semantic, timeout, overwrite, results):46 bench_one(cmd=(os.path.join(path_to_mutoksia, "bin", "mu-toksia.exe"), "-p", s_to_m[semantic], "-f", filename, "-fo", "apx"),47 out=os.path.join(path_to_mutoksia, results, f"{stub}.{semantic}"),48 timeout=timeout,49 overwrite=overwrite)50def main():51 overwrite = (len(sys.argv) == 2 and sys.argv[1] == "-o")52 # path_to_aaf_cadical = sys.argv[1]53 # path_to_mutoksia = sys.argv[2]54 # path_to_generated = sys.argv[3]55 # timeout = sys.argv[4]56 path_to_aaf_cadical = r"C:\Users\asib1\Documents\Asib\uni\ba_baumann\benching\aaf-cadical"57 path_to_mutoksia = r"C:\Users\asib1\Documents\Asib\uni\ba_baumann\benching\mutoksia"58 path_to_generated = r"C:\Users\asib1\Documents\Asib\uni\ba_baumann\benching\aafs"59 path_to_iccma19 = r"C:\Users\asib1\Documents\Asib\uni\ba_baumann\iccma19\instances"60 timeout = 60061 # bench(overwrite, path_to_aaf_cadical, path_to_generated, path_to_mutoksia, timeout, "results_test")62 if RUN == "gen":63 r = "results_gen"64 p = path_to_generated65 elif RUN == "iccma19":66 r = "results_iccma19"67 p = path_to_iccma1968 69 bench(overwrite, path_to_aaf_cadical, p, path_to_mutoksia, timeout, r)70def bench(overwrite, path_to_aaf_cadical, path_to_aafs, path_to_mutoksia, timeout, results):71 for file in os.listdir(os.fsencode(path_to_aafs)):72 filename = os.fsdecode(file)73 filepath = os.path.join(path_to_aafs, filename)74 match = re.search(r"(.+)\.apx", filename)75 if match and filepath.endswith(".apx"):76 stub = match[1]77 for semantic in SEMANTICS:78 bench_aaf_cadical(path_to_aaf_cadical, filepath, stub, semantic, timeout, overwrite, results)79 bench_mutoksia(path_to_mutoksia, filepath, stub, semantic, timeout, overwrite, results)80if __name__ == '__main__':...

Full Screen

Full Screen

make_plot.py

Source:make_plot.py Github

copy

Full Screen

1import matplotlib.pyplot as plt2def parse_bitrate(source):3 with open(source) as file:4 lines = file.readlines()5 bitrates = [float(line.split()[2]) for line in lines]6 return bitrates7def parse_psnr(source):8 with open(source) as file:9 lines = file.readlines()10 psnr = [float(line.split('=')[-1]) for line in lines]11 qp = [int(line.split('=')[1].split()[0]) for line in lines]12 return psnr, qp13path_to_black = "results/black"14path_to_generated = "results/generated"15bitrate_filename = "bitrate.txt"16psnr_filename = "results.txt"17count_last = 418bitrates_black = parse_bitrate(f"{path_to_black}/{bitrate_filename}")19psnr_black, qp = parse_psnr(f"{path_to_black}/{psnr_filename}")20bitrates_black = bitrates_black[-count_last:]21psnr_black = psnr_black[-count_last:]22qp = qp[-count_last:]23print(bitrates_black, psnr_black)24bitrates = parse_bitrate(f"{path_to_generated}/{bitrate_filename}")25psnr, _ = parse_psnr(f"{path_to_generated}/{psnr_filename}")26bitrates = bitrates[-count_last:]27psnr = psnr[-count_last:]28print(bitrates, psnr)29plt.plot(bitrates_black, psnr_black, label="black")30plt.plot(bitrates, psnr, label=f"generated")31plt.scatter(bitrates_black, psnr_black)32plt.scatter(bitrates, psnr)33for i in range(len(psnr)):34 plt.text(bitrates_black[i], psnr_black[i], qp[i], fontsize=9)35 plt.text(bitrates[i], psnr[i], qp[i], fontsize=9)36# plt.title(f'Sasha')37plt.xlabel('Bitrate')38plt.ylabel('PSNR')39plt.legend()40plt.grid()...

Full Screen

Full Screen

settings.py

Source:settings.py Github

copy

Full Screen

1import os.path2SAMPLERATE = 441003SRC_FOLDER = os.path.abspath(os.path.join("realisations", "cpp"))4PATH_TO_GENERATED = os.path.abspath("tmp/generated")5GENERATED_CPP = os.path.join(PATH_TO_GENERATED, "cpp")6PATH_TO_CPP = os.path.abspath("cpp")7TEMPLATES_FOLDER = os.path.join(PATH_TO_CPP, "templates")8FOLDER_TO_COMPILE = os.path.abspath("tmp/to_compile")9RESULTS_FOLDER = os.path.abspath("results")...

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