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, key_path=None)
Stage files by copying.
Stage files and directories.
- Parameters:
config (dict | Path | str | 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.key_path (list[bool | float | int | str] | None) – Path of keys to config block to use.
- Raises:
UWConfigErrorif config fails validation.
- go()
Copy files.
- class uwtools.api.fs.Linker(config=None, target_dir=None, cycle=None, leadtime=None, key_path=None)
Stage files by linking.
Stage files and directories.
- Parameters:
config (dict | Path | str | 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.key_path (list[bool | float | int | str] | None) – Path of keys to config block to use.
- Raises:
UWConfigErrorif config fails validation.
- go()
Link files.
- class uwtools.api.fs.MakeDirs(config=None, target_dir=None, cycle=None, leadtime=None, key_path=None)
Make directories.
Stage files and directories.
- Parameters:
config (dict | Path | str | 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.key_path (list[bool | float | int | str] | None) – Path of keys to config block to use.
- Raises:
UWConfigErrorif config fails validation.
- go()
Make directories.
- uwtools.api.fs.copy(config=None, target_dir=None, cycle=None, leadtime=None, key_path=None, dry_run=False, stdin_ok=False)
Copy files.
- Parameters:
config (dict | Path | str | 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.
key_path (list[bool | float | int | str] | None) – Path of keys to config block to use.
dry_run (bool) – Do not copy files.
stdin_ok (bool) – OK to read from
stdin?
- Returns:
A report on files copied / not copied.
- Return type:
- uwtools.api.fs.link(config=None, target_dir=None, cycle=None, leadtime=None, key_path=None, dry_run=False, stdin_ok=False)
Link files.
- Parameters:
config (dict | Path | str | 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.
key_path (list[bool | float | int | str] | None) – Path of keys to config block to use.
dry_run (bool) – Do not link files.
stdin_ok (bool) – OK to read from
stdin?
- Returns:
A report on files linked / not linked.
- Return type:
- uwtools.api.fs.makedirs(config=None, target_dir=None, cycle=None, leadtime=None, key_path=None, dry_run=False, stdin_ok=False)
Make directories.
- Parameters:
config (dict | Path | str | 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.
key_path (list[bool | float | int | str] | None) – Path of keys to config block to use.
dry_run (bool) – Do not create directories.
stdin_ok (bool) – OK to read from
stdin?
- Returns:
A report on directories created / not created.
- Return type: