Validators
The otter.validators package contains tools for validation of tasks, and some
built-in validators.
Module contents
Validator module.
validators.file module
File validators.
- async otter.validators.file.async_exists(location: str, config: Config | None = None, force_local: bool = False) None[source]
Check if a file exists, asynchronously.
Optionally takes a
otter.config.model.Configinstance to work with relative locations.- Parameters:
location (str) – The file location.
config (Config | None) – The
otter.config.model.Configinstance.force_local (bool) – Whether to force local resolution.
- Raises:
TaskValidationError – If the file does not exist.
- otter.validators.file.exists(location: str, config: Config | None = None, force_local: bool = False) None[source]
Check if a file exists.
Optionally takes a
otter.config.model.Configinstance to work with relative locations.- Parameters:
location (str) – The file location.
config (Config | None) – The
otter.config.model.Configinstance.force_local (bool) – Whether to force local resolution.
- Raises:
TaskValidationError – If the file does not exist.
- async otter.validators.file.async_size(one: str, two: str, config: Config | None = None, force_local: bool = False) None[source]
Check if two files have the same size.
Optionally takes a
otter.config.model.Configinstance to work with relative locations.If the file size cannot be determined for either file, it logs a warning but does not fail validation, since many sources do not provide file size information.
- Parameters:
one (str) – The first file location
two (str) – The second file location
config (Config | None) – The
otter.config.model.Configinstance.force_local (bool) – Whether to force local resolution on the second file.
- Raises:
TaskValidationError – If the file sizes does not match.
- otter.validators.file.size(one: str, two: str, config: Config | None = None, force_local: bool = False) None[source]
Check if two files have the same size, synchronously.
Optionally takes a
otter.config.model.Configinstance to work with relative locations.If the file size cannot be determined for either file, it logs a warning but does not fail validation, since many sources do not provide file size information.
- Parameters:
one (str) – The first file location
two (str) – The second file location
config (Config | None) – The
otter.config.model.Configinstance.force_local (bool) – Whether to force local resolution on the second file.
- Raises:
TaskValidationError – If the file sizes does not match.