MCPcopy Index your code
hub / github.com/python/mypy / is_alias_for_final_name

Method is_alias_for_final_name

mypy/semanal.py:4514–4534  ·  view source on GitHub ↗
(self, name: str)

Source from the content-addressed store, hash-verified

4512 return False
4513
4514 def is_alias_for_final_name(self, name: str) -> bool:
4515 if self.is_func_scope():
4516 if not name.endswith("'"):
4517 # Not a mangled name -- can't be an alias
4518 return False
4519 name = unmangle(name)
4520 assert self.locals[-1] is not None, "No locals at function scope"
4521 existing = self.locals[-1].get(name)
4522 return existing is not None and is_final_node(existing.node)
4523 elif self.type is not None:
4524 orig_name = unmangle(name) + "'"
4525 if name == orig_name:
4526 return False
4527 existing = self.type.names.get(orig_name)
4528 return existing is not None and is_final_node(existing.node)
4529 else:
4530 orig_name = unmangle(name) + "'"
4531 if name == orig_name:
4532 return False
4533 existing = self.globals.get(orig_name)
4534 return existing is not None and is_final_node(existing.node)
4535
4536 def make_name_lvalue_var(
4537 self,

Callers 1

analyze_name_lvalueMethod · 0.95

Calls 5

is_func_scopeMethod · 0.95
unmangleFunction · 0.90
is_final_nodeFunction · 0.90
endswithMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected