Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def create_run_driver_function(driver: str, options: CmdOptionList):
@cli.command(name=driver, short_help=command_docs[driver])
@click.argument("run_file", default="")
@cmd_option(options)
def _func(*args, **kwargs):
globals()["temci__" + driver](*args, **kwargs)
def _func2(run_file, **kwargs):
Settings()["run/driver"] = driver
if run_file is not "":
Settings()["run/in"] = run_file
benchmark_and_exit()
_func2.__name__ = "temci__" + driver
document_func(command_docs[driver], options, argument="configuration YAML file")(_func2)
globals()["temci__" + driver] = _func2
@document_func(misc_commands_description["short"]["shell"], common_options,
misc_commands["short"]["sub_commands"]["shell"])
def temci__short__shell(command: str, **kwargs):
Settings()["run/driver"] = "shell"
Settings()["run/runs"] = 1
Settings()["run/discarded_runs"] = 0
Settings()["run/cpuset/parallel"] = 0
benchmark_and_exit([{"run_config": {
"run_cmd": command
},
"attributes": {
"description": command
}
@document_func(command_docs["format"],
common_options,
format_options)
def temci__format(number, abs_deviation, **kwargs):
print(FNumber(number, abs_deviation=abs_deviation).format())
@document_func(command_docs["report"], common_options, report_options)
def temci__report(report_file: t.List[str], **kwargs):
Settings()["report/in"] = report_file
ReportProcessor().report()
@document_func(misc_commands_description["init"]["settings"],
misc_commands["init"]["sub_commands"]["settings"],
common_options)
def temci__init__settings(file, **kwargs):
Settings().store_into_file(file)
@document_func(misc_commands_description["completion"]["zsh"], common_options)
def temci__completion__zsh():
subcommands = "\n\t".join(['"{}:{}"'.format(cmd, command_docs[cmd])
for cmd in sorted(command_docs.keys())])
def process_options(options: CmdOptionList, one_line=False):
typecheck(options, CmdOptionList)
strs = []
for option in sorted(options):
multiple = isinstance(option.type_scheme, List) or isinstance(option.type_scheme, ListOrTuple)
rounds = 10 if multiple else 1 # hack to allow multiple applications of an option
assert isinstance(option, CmdOption)
descr = "{}".format(option.description) if option.description is not None else "Undoc"
option_str = "--{}".format(option.option_name)
if option.has_short:
option_str = "{{-{},--{}}}".format(option.short, option.option_name)
if option.is_flag:
@document_func(command_docs["setup"])
def temci__setup():
from temci.setup.setup import make_scripts
make_scripts()
@document_func(command_docs["clean"], common_options)
def temci__clean(**kwargs):
shutil.rmtree(Settings()["tmp_dir"])