path_is_relative_to¶
- pathwalker.path_is_relative_to(path_to_check: pathlib.Path, other_path: pathlib.Path) bool ¶
Return whether or not this path is relative to the other path.
- Parameters
path_to_check – The path to check for being a sub path of the other path.
other_path – The other path, which may be a parent path of the path to check.
- Returns
bool
Examples
>>> from pathwalker import path_is_relative_to >>> from pathlib import Path >>> path_is_relative_to(path_to_check=Path("/a/b"), other_path=Path("/a")) True >>> path_is_relative_to(path_to_check=Path("/a/b"), other_path=Path("/c")) False >>> path_is_relative_to(path_to_check=Path("/ab"), other_path=Path("/a")) False