dictIO.utils.path¶
Utility functions for working with paths.
Functions
|
Return the highest common root folder among the passed in paths. |
|
Return the relative path from one path to another. |
- dictIO.utils.path.highest_common_root_folder(paths: Sequence[Path]) Path ¶
Return the highest common root folder among the passed in paths.
- Parameters:
paths (Sequence[Path]) – A sequence of path objects. Can be files or folders, or both.
- Returns:
The highest common root folder among the passed in paths.
- Return type:
Path
- Raises:
ValueError – If argument ‘paths’ is empty or if the passed in paths do not share a common root folder.
- dictIO.utils.path.relative_path(from_path: Path, to_path: Path) Path ¶
Return the relative path from one path to another.
- Parameters:
from_path (Path) – The start point path.
to_path (Path) – The end point path.
- Returns:
The relative path from ‘from_path’ (the start point) to ‘to_path’ (the end point).
- Return type:
Path
- Raises:
ValueError – If no relative path between ‘from_path’ and ‘to_path’ can be resolved.