MCPcopy
hub / github.com/python/mypy / lookup

Method lookup

mypy/checker.py:7843–7854  ·  view source on GitHub ↗

Look up a definition from the symbol table with the given name.

(self, name: str)

Source from the content-addressed store, hash-verified

7841 )
7842
7843 def lookup(self, name: str) -> SymbolTableNode:
7844 """Look up a definition from the symbol table with the given name."""
7845 if name in self.globals:
7846 return self.globals[name]
7847 else:
7848 b = self.globals.get("__builtins__", None)
7849 if b:
7850 assert isinstance(b.node, MypyFile)
7851 table = b.node.names
7852 if name in table:
7853 return table[name]
7854 raise KeyError(f"Failed lookup: {name}")
7855
7856 def lookup_qualified(self, name: str) -> SymbolTableNode:
7857 if "." not in name:

Callers 3

lookup_qualifiedMethod · 0.95
visit_unbound_typeMethod · 0.45
_belongs_to_runtimeFunction · 0.45

Calls 3

isinstanceFunction · 0.85
KeyErrorClass · 0.85
getMethod · 0.45

Tested by 1

_belongs_to_runtimeFunction · 0.36