(path: str, scope: str)
| 1083 | |
| 1084 | |
| 1085 | def path_within_scope(path: str, scope: str) -> bool: |
| 1086 | candidate = PurePosixPath(path) |
| 1087 | requested = PurePosixPath(scope) |
| 1088 | if candidate.is_absolute() or ".." in candidate.parts: |
| 1089 | return False |
| 1090 | if requested == PurePosixPath("."): |
| 1091 | return True |
| 1092 | return candidate == requested or requested in candidate.parents |
| 1093 | |
| 1094 | |
| 1095 | def require_scope(scope: str, mode: str, target: Path) -> str: |
no outgoing calls
no test coverage detected