MCPcopy Create free account
hub / github.com/Graphify-Labs/graphify / _resolve_inside

Function _resolve_inside

graphify/sections.py:73–83  ·  view source on GitHub ↗

The file ``source_file`` names, or None when it falls outside ``root``.

(source_file: str, root: Path)

Source from the content-addressed store, hash-verified

71
72
73def _resolve_inside(source_file: str, root: Path) -> "Path | None":
74 """The file ``source_file`` names, or None when it falls outside ``root``."""
75 candidate = Path(source_file)
76 if not candidate.is_absolute():
77 candidate = root / candidate
78 try:
79 resolved = candidate.resolve()
80 resolved.relative_to(root.resolve())
81 except (OSError, RuntimeError, ValueError):
82 return None
83 return resolved
84
85
86def section_root(gp: Path) -> Path:

Callers 1

read_sectionFunction · 0.85

Calls 1

resolveMethod · 0.45

Tested by

no test coverage detected