(path: str, root: Path)
| 86 | |
| 87 | |
| 88 | def normalize(path: str, root: Path) -> str: |
| 89 | p = Path(path).expanduser() |
| 90 | if not p.is_absolute(): |
| 91 | p = root / p |
| 92 | try: |
| 93 | return p.resolve().relative_to(root.resolve()).as_posix() |
| 94 | except ValueError: |
| 95 | return p.as_posix() |
| 96 | |
| 97 | |
| 98 | def extract_paths(payload: dict, root: Path) -> list[str]: |