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

Function _python_self_attr

graphify/extractors/engine.py:4113–4120  ·  view source on GitHub ↗

``X`` when ``node`` is the attribute ``self.X`` (#2860), else None.

(node, source: bytes)

Source from the content-addressed store, hash-verified

4111
4112
4113def _python_self_attr(node, source: bytes) -> str | None:
4114 """``X`` when ``node`` is the attribute ``self.X`` (#2860), else None."""
4115 if node is None or node.type != "attribute":
4116 return None
4117 obj, attr = node.child_by_field_name("object"), node.child_by_field_name("attribute")
4118 if obj is None or attr is None or _read_text(obj, source) != "self":
4119 return None
4120 return _read_text(attr, source)
4121
4122def _python_self_attr_bindings(body, source: bytes, local_types: dict[str, str | None] | None = None):
4123 """Yield ``(attr, type_name)`` for every ``self.attr = ...`` in a method body

Callers 3

_python_property_readsFunction · 0.85
walk_callsFunction · 0.85

Calls 1

_read_textFunction · 0.90

Tested by

no test coverage detected