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

Function _python_private_prefix

graphify/extractors/engine.py:12968–12979  ·  view source on GitHub ↗
(node)

Source from the content-addressed store, hash-verified

12966 python_lambda_bindings: dict[int, tuple[str, set[str]]] = {}
12967
12968 def _python_private_prefix(node) -> str:
12969 # A nested class's bases and decorators still use the outer class's
12970 # private names. A class supplies its own prefix inside its body.
12971 while (parent := node.parent) is not None:
12972 if parent.type == "class_definition" and node == parent.child_by_field_name("body"):
12973 class_name = parent.child_by_field_name("name")
12974 if class_name is None:
12975 return ""
12976 name = normalize("NFKC", _read_text(class_name, source)).lstrip("_")
12977 return f"_{name}" if name else ""
12978 node = parent
12979 return ""
12980
12981 def _python_binding_name(name: str, private_prefix: str) -> str:
12982 name = normalize("NFKC", name)

Callers 1

Calls 2

_read_textFunction · 0.90
normalizeFunction · 0.85

Tested by

no test coverage detected