Get the path relative to the root directory.
(path: Path, root=ROOT_DIR)
| 374 | |
| 375 | |
| 376 | def relative_path_from_root(path: Path, root=ROOT_DIR) -> Path: |
| 377 | """Get the path relative to the root directory.""" |
| 378 | if not path.is_absolute(): |
| 379 | path = path.resolve() |
| 380 | if not path.is_relative_to(root): |
| 381 | raise ValueError(f"Path '{path}' is not under the root directory '{root}'") |
| 382 | return path.relative_to(root) |
| 383 | |
| 384 | |
| 385 | def _walk_with_exclusion( |
no outgoing calls
no test coverage detected