materials_commons.cli.subcommands.down module¶
- materials_commons.cli.subcommands.down.down_subcommand(argv, working_dir)[source]¶
download files from Materials Commons
mc down [-r] [<pathspec> …]
- materials_commons.cli.subcommands.down.download_file_as_string(client, project_id, file_id)[source]¶
- materials_commons.cli.subcommands.down.make_parser()[source]¶
Make argparse.ArgumentParser for mc down
- materials_commons.cli.subcommands.down.print_file(proj, path, working_dir)[source]¶
Print a remote file, without writing it locally
proj: mcapi.Project, Project to get file from
path: str, Materials Commons style path of file to print
- working_dir (str): Current working directory, used for finding relative
paths and printing messages.
- materials_commons.cli.subcommands.down.standard_download(proj, path, working_dir, force=False, output=None, recursive=False, no_compare=False, localtree=None, remotetree=None)[source]¶
Download files and directories
proj: mcapi.Project, Project to download from
path: str, Materials Commons style path of file or directory to download
- working_dir (str): Current working directory, used for finding relative
paths and printing messages.
force: bool (optional, default=False) If True, force overwrite existing files without confirmation.
- output: str (optional, default=None)
Specify a different download location. By default, files are downloaded to the matching location in the local project directory. For example remote file at “/A/B/file.txt” is downloaded to “<proj.local_path>/A/B/file.txt” by default.
recursive: bool (optional, default=False) Download directory contents recursively.
- no_compare: bool (optional, default=False)
By default, this function checks local and remote file checksum to avoid downloading files that already exist. If no_compare is True, this check is skipped and all specified files are downloaded, even if an equivalent file already exists locally.
- localtree: LocalTree object (optional, default=None)
A LocalTree object stores local file checksums to avoid unnecessary hashing. Will be used and updated if provided and checksum == True.
- remotetree: RemoteTree object (optional, default=None)
A RemoteTree object stores remote file and directory information to minimize API calls and data transfer. Will be used and updated if provided.
success: bool, True if download succeeds, False otherwise