assets_guardian.core.domain.models.locationο
Classes
|
Representation and validation of a file location (local or remote). |
|
- class assets_guardian.core.domain.models.location.Location(raw_path: str)[source]ο
Bases:
objectRepresentation and validation of a file location (local or remote).
This class parses a prefixed path (e.g., βlocal:./outputs/file.xlsxβ), identifies its type, and validates its existence.
- Variables:
raw_path (str) β The original raw path with prefix (e.g., local:./outputs).
path_type (assets_guardian.core.domain.models.location.PathType) β The path type (LOCAL, REMOTE).
clean_path (str) β The path without the prefix.
Initializes a new Location instance.
- Parameters:
raw_path β The prefixed path (e.g., βlocal:./outputs/file.xlsxβ).
- validate_location(is_folder: bool = False, require_exists: bool = False) None[source]ο
Validates the consistency of the path.
- Parameters:
is_folder β If True, asserts that the path points to a directory.
require_exists β If True, physical existence of the path is required.
- Raises:
NotImplementedError β If the prefix is βremoteβ (unsupported currently).
ValueError β If the prefix is missing or invalid.
NotADirectoryError β If is_folder is True but the path is not a directory.
FileNotFoundError β If require_exists is True but the path is not found.