MCPcopy Index your code
hub / github.com/DeepLabCut/DeepLabCut / _is_safe_relpath

Function _is_safe_relpath

tools/test_selector.py:276–284  ·  view source on GitHub ↗

Safety check for a git-relative path: no absolute, no traversal, no NUL.

(p: str)

Source from the content-addressed store, hash-verified

274
275
276def _is_safe_relpath(p: str) -> bool:
277 """Safety check for a git-relative path: no absolute, no traversal, no NUL."""
278 return (
279 p
280 and "\x00" not in p
281 and not p.startswith("/")
282 and not re.match(r"^[A-Za-z]:/", p)
283 and ".." not in Path(p).parts
284 )
285
286
287def validate_selected_paths(res: SelectorResult, repo: Path) -> SelectorResult:

Callers 1

validate_selected_pathsFunction · 0.85

Calls 1

matchMethod · 0.80

Tested by

no test coverage detected