Skip to content

Commit 390705d

Browse files
committed
A little speed-up
1 parent e05e518 commit 390705d

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

mypy/semanal.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6296,8 +6296,16 @@ def lookup(
62966296
return node
62976297

62986298
def record_imported_symbol(self, node: SymbolNode) -> None:
6299-
fullname = node.fullname
6300-
if not isinstance(node, MypyFile):
6299+
if isinstance(node, MypyFile):
6300+
fullname = node.fullname
6301+
elif isinstance(node, TypeInfo):
6302+
fullname = node.module_name
6303+
elif isinstance(node, TypeAlias):
6304+
fullname = node.module
6305+
elif isinstance(node, (Var, FuncDef, OverloadedFuncDef)) and node.info:
6306+
fullname = node.info.module_name
6307+
else:
6308+
fullname = node.fullname.rsplit(".")[0]
63016309
while fullname not in self.modules and "." in fullname:
63026310
fullname = fullname.rsplit(".")[0]
63036311
if fullname != self.cur_mod_id and fullname not in self.cur_mod_node.module_refs:

0 commit comments

Comments
 (0)