Beispiel #1
0
def _init_flags(run, args):
    arg_flags, other_args = op_util.args_to_flags(args)
    if other_args:
        log.warning(
            "unexpected args: %s",
            " ".join([util.shlex_quote(arg) for arg in other_args]),
        )
    flags = run.get("flags", {})
    flags.update(arg_flags)
    return flags
Beispiel #2
0
def main():
    _init_logging()
    args, rest_args = _parse_args()
    run = _init_run(args)
    _check_env()
    flags, other_args = op_util.args_to_flags(rest_args)
    if other_args:
        log.warning(
            "unexpected args: %s",
            " ".join([util.shlex_quote(arg) for arg in other_args]),
        )
    run_notebook = _init_run_notebook(args.notebook, flags, run)
    if args.no_exec or os.getenv("NB_NO_EXEC") == "1":
        log.info("NB_NO_EXEC specified, skipping execute")
        return
    _nbexec(run_notebook)
    _print_output(run_notebook)
    _save_images(run_notebook)
    _nbconvert_html(run_notebook)
Beispiel #3
0
def _split_args_and_flags(args):
    flags, other_args = op_util.args_to_flags(args)
    return other_args, flags
Beispiel #4
0
def _cmd_arg_env(args):
    flags, _other_args = op_util.args_to_flags(args)
    return {
        name.upper(): str(val)
        for name, val in flags.items()
    }
Beispiel #5
0
def _base_args_and_flags_for_globals(args):
    flags, other_args = op_util.args_to_flags(args)
    return other_args, flags