(option: str)
| 23 | |
| 24 | |
| 25 | def parse_map_local_spec(option: str) -> MapLocalSpec: |
| 26 | filter, regex, replacement = parse_spec(option) |
| 27 | |
| 28 | try: |
| 29 | re.compile(regex) |
| 30 | except re.error as e: |
| 31 | raise ValueError(f"Invalid regular expression {regex!r} ({e})") |
| 32 | |
| 33 | try: |
| 34 | path = Path(replacement).expanduser().resolve(strict=True) |
| 35 | except FileNotFoundError as e: |
| 36 | raise ValueError(f"Invalid file path: {replacement} ({e})") |
| 37 | |
| 38 | return MapLocalSpec(filter, regex, path) |
| 39 | |
| 40 | |
| 41 | def _safe_path_join(root: Path, untrusted: str) -> Path: |
no test coverage detected
searching dependent graphs…