quantlab.utils.cli.resolve_output_dirs#

quantlab.utils.cli.resolve_output_dirs(args)[source]#

Return (download_dir, data_dir) from parsed arguments, as absolute paths.

~ is expanded and a relative path is anchored at the current directory, so the paths recorded in configs and sidecars stay valid when a later process runs from somewhere else. Symlinks are not resolved. Neither directory is created here.

Parameters:
argsargparse.Namespace

Arguments parsed by a parser that went through add_output_dir_args.

Returns:
tuple[pathlib.Path, pathlib.Path]

The download directory and the data root.

Examples

>>> parser = add_output_dir_args(argparse.ArgumentParser())
>>> download_dir, data_dir = resolve_output_dirs(parser.parse_args([]))
>>> download_dir == Path.cwd() and data_dir == Path.cwd()
True