assets_guardian.core.domain.models.location

Classes

Location(raw_path)

Representation and validation of a file location (local or remote).

PathType(*values)

class assets_guardian.core.domain.models.location.Location(raw_path: str)[source]

Bases: object

Representation 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:

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.

class assets_guardian.core.domain.models.location.PathType(*values)[source]

Bases: StrEnum