MCPcopy Create free account
hub / github.com/FSoft-AI4Code/CodeWiki / _inside

Function _inside

codewiki/src/be/dependency_analyzer/utils/security.py:4–10  ·  view source on GitHub ↗
(base: Path, target: Path)

Source from the content-addressed store, hash-verified

2from pathlib import Path
3
4
5def _inside(base: Path, target: Path) -> bool:
6 base_r = base.resolve()
7 try:
8 target_r = target.resolve()
9 return target_r.is_relative_to(base_r) # py>=3.9
10 except AttributeError:
11 return str(target.resolve()).startswith(str(base_r))
12
13

Callers 1

assert_safe_pathFunction · 0.85

Calls 1

resolveMethod · 0.80

Tested by

no test coverage detected