noether.core.utils.common.path¶
Functions¶
|
Converts a string to a Path, validates it, and optionally creates it. |
|
Access values of an object, a list or a dictionary using a string path. |
Module Contents¶
- noether.core.utils.common.path.validate_path(path, exists='must', suffix=None, mkdir=False)¶
Converts a string to a Path, validates it, and optionally creates it.
- Parameters:
path (str | pathlib.Path) – The path string to validate.
exists (Literal['must', 'must_not', 'any']) –
“must”: Raises FileNotFoundError if the path doesn’t exist.
”must_not”: Raises FileExistsError if the path already exists.
”any”: Performs no existence check.
suffix (str | None) – If provided, checks if the path ends with this suffix.
mkdir (bool) – If True, creates the directory path (like mkdir -p).
- Returns:
The validated path.
- Return type:
Path
- noether.core.utils.common.path.select_with_path(obj, path)¶
Access values of an object, a list or a dictionary using a string path.