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

Function _probe_python_module_candidate

graphify/extractors/resolution.py:3509–3522  ·  view source on GitHub ↗

Resolve native Python modules and packages before declared suffixes.

(candidate: Path)

Source from the content-addressed store, hash-verified

3507
3508
3509def _probe_python_module_candidate(candidate: Path) -> Path | None:
3510 """Resolve native Python modules and packages before declared suffixes."""
3511 if candidate.is_dir():
3512 init_path = candidate / "__init__.py"
3513 if init_path.is_file() and effective_suffix(init_path) == ".py":
3514 return init_path
3515 if candidate.is_file():
3516 return candidate
3517 if not candidate.name:
3518 return _probe_declared_python_module_candidate(candidate)
3519 py_candidate = candidate.with_suffix(".py")
3520 if py_candidate.is_file() and effective_suffix(py_candidate) == ".py":
3521 return py_candidate
3522 return _probe_declared_python_module_candidate(candidate)
3523
3524
3525# Cache: scan root (resolved str) → dotted namespace prefix or ""

Calls 2

effective_suffixFunction · 0.90

Tested by

no test coverage detected