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

Function is_shadowed

graphify/extractors/python_scope.py:80–96  ·  view source on GitHub ↗
(call, name: str)

Source from the content-addressed store, hash-verified

78 return scopes[scope.id]
79
80 def is_shadowed(call, name: str) -> bool:
81 node = call
82 nearest = True
83 while (parent := node.parent) is not None:
84 if parent.type in ("function_definition", "class_definition"):
85 body = parent.child_by_field_name("body")
86 if node == body:
87 is_function = parent.type == "function_definition"
88 if is_function or nearest:
89 params, rebound = facts(parent, body)
90 if name in rebound:
91 return False
92 if is_function and name in params:
93 return True
94 nearest = False
95 node = parent
96 return False
97
98 return is_shadowed

Callers

nothing calls this directly

Calls 1

factsFunction · 0.70

Tested by

no test coverage detected