8000 Remove redundant lookup funcs in fixup.py by 97littleleaf11 · Pull Request #11253 · python/mypy · GitHub
[go: up one dir, main page]

Skip to content

Remove redundant lookup funcs in fixup.py #11253

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Oct 8, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix
  • Loading branch information
97littleleaf11 committed Oct 3, 2021
commit 5078078220f825bb19e8c06c997f75b232ecae19
13 changes: 6 additions & 7 deletions mypy/fixup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
from typing_extensions import Final

from mypy.nodes import (
MypyFile, SymbolNode, SymbolTable, SymbolTableNode,
TypeInfo, FuncDef, OverloadedFuncDef, Decorator, Var,
TypeVarExpr, ClassDef, Block, TypeAlias,
MypyFile, SymbolTable, TypeInfo, FuncDef, OverloadedFuncDef,
Decorator, Var, TypeVarExpr, ClassDef, Block, TypeAlias,
)
from mypy.types import (
CallableType, Instance, Overloaded, TupleType, TypedDictType,
Expand Down Expand Up @@ -74,7 +73,7 @@ def visit_symbol_table(self, symtab: SymbolTable, table_fullname: str) -> None:
if cross_ref in self.modules:
value.node = self.modules[cross_ref]
else:
stnode = lookup_fully_qualified(self.modules, cross_ref, self.allow_missing)
stnode = lookup_fully_qualified(cross_ref, self.modules, self.allow_missing)
if stnode is not None:
assert stnode.node is not None, (table_fullname + "." + key, cross_ref)
value.node = stnode.node
Expand Down Expand Up @@ -227,7 +226,7 @@ def visit_typeddict_type(self, tdt: TypedDictType) -> None:
it.accept(self)
if tdt.fallback is not None:
if tdt.fallback.type_ref is not None:
if lookup_fully_qualified(self.modules, tdt.fallback.type_ref,
if lookup_fully_qualified(tdt.fallback.type_ref, self.modules,
self.allow_missing) is None:
# We reject fake TypeInfos for TypedDict fallbacks because
# the latter are used in type checking and must be valid.
A0F8 Expand Down Expand Up @@ -262,7 +261,7 @@ def visit_type_type(self, t: TypeType) -> None:

def lookup_qualified_typeinfo(modules: Dict[str, MypyFile], name: str,
allow_missing: bool) -> TypeInfo:
stnode = lookup_fully_qualified(modules, name, allow_missing)
stnode = lookup_fully_qualified(name, modules, allow_missing)
node = stnode.node if stnode else None
if isinstance(node, TypeInfo):
return node
Expand All @@ -277,7 +276,7 @@ def lookup_qualified_typeinfo(modules: Dict[str, MypyFile], name: str,

def lookup_qualified_alias(modules: Dict[str, MypyFile], name: str,
allow_missing: bool) -> TypeAlias:
stnode = lookup_fully_qualified(modules, name, allow_missing)
stnode = lookup_fully_qualified(name, modules, allow_missing)
node = stnode.node if stnode else None
if isinstance(node, TypeAlias):
return node
Expand Down
0