uwtools.api.fs
API access to uwtools file and directory management tools.
- class uwtools.api.fs.Copier(config=None, target_dir=None, cycle=None, leadtime=None, keys=None, dry_run=False)
Stage files by copying.
Stage files and directories.
- Parameters:
config (dict | str | Path | None) – YAML-file path, or
dict(readstdinif missing orNone).cycle (datetime | None) – A
datetimeobject to make available for use in the config.leadtime (timedelta | None) – A
timedeltaobject to make available for use in the config.keys (list[str] | None) – YAML keys leading to file dst/src block.
dry_run (bool) – Do not copy files.
- Raises:
UWConfigErrorif config fails validation.
- go()
Copy files.
- class uwtools.api.fs.Linker(config=None, target_dir=None, cycle=None, leadtime=None, keys=None, dry_run=False)
Stage files by linking.
Stage files and directories.
- Parameters:
config (dict | str | Path | None) – YAML-file path, or
dict(readstdinif missing orNone).cycle (datetime | None) – A
datetimeobject to make available for use in the config.leadtime (timedelta | None) – A
timedeltaobject to make available for use in the config.keys (list[str] | None) – YAML keys leading to file dst/src block.
dry_run (bool) – Do not copy files.
- Raises:
UWConfigErrorif config fails validation.
- go()
Link files.
- class uwtools.api.fs.MakeDirs(config=None, target_dir=None, cycle=None, leadtime=None, keys=None, dry_run=False)
Make directories.
Stage files and directories.
- Parameters:
config (dict | str | Path | None) – YAML-file path, or
dict(readstdinif missing orNone).cycle (datetime | None) – A
datetimeobject to make available for use in the config.leadtime (timedelta | None) – A
timedeltaobject to make available for use in the config.keys (list[str] | None) – YAML keys leading to file dst/src block.
dry_run (bool) – Do not copy files.
- Raises:
UWConfigErrorif config fails validation.
- go()
Make directories.
- uwtools.api.fs.copy(config=None, target_dir=None, cycle=None, leadtime=None, keys=None, dry_run=False, stdin_ok=False)
Copy files.
- Parameters:
config (dict | str | Path | None) – YAML-file path, or
dict(readstdinif missing orNone).cycle (datetime | None) – A datetime object to make available for use in the config.
leadtime (timedelta | None) – A timedelta object to make available for use in the config.
keys (list[str] | None) – YAML keys leading to file dst/src block.
dry_run (bool) – Do not copy files.
stdin_ok (bool) – OK to read from
stdin?
- Returns:
Trueif all copies were created.- Return type:
- uwtools.api.fs.link(config=None, target_dir=None, cycle=None, leadtime=None, keys=None, dry_run=False, stdin_ok=False)
Link files.
- Parameters:
config (dict | str | Path | None) – YAML-file path, or
dict(readstdinif missing orNone).cycle (datetime | None) – A datetime object to make available for use in the config.
leadtime (timedelta | None) – A timedelta object to make available for use in the config.
keys (list[str] | None) – YAML keys leading to file dst/src block.
dry_run (bool) – Do not link files.
stdin_ok (bool) – OK to read from
stdin?
- Returns:
Trueif all links were created.- Return type:
- uwtools.api.fs.makedirs(config=None, target_dir=None, cycle=None, leadtime=None, keys=None, dry_run=False, stdin_ok=False)
Make directories.
- Parameters:
config (dict | str | Path | None) – YAML-file path, or
dict(readstdinif missing orNone).cycle (datetime | None) – A datetime object to make available for use in the config.
leadtime (timedelta | None) – A timedelta object to make available for use in the config.
keys (list[str] | None) – YAML keys leading to file dst/src block.
dry_run (bool) – Do not link files.
stdin_ok (bool) – OK to read from
stdin?
- Returns:
Trueif all directories were made.- Return type: