-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
5c581a5
Remove redundant lookup func in fixup.py
97littleleaf11 5078078
Fix
97littleleaf11 7ee3c4a
Fix type-check
97littleleaf11 73e2650
Change raise_on_missing_ to suppress_errors
97littleleaf11 cdbf0cc
Rename
97littleleaf11 ebc47d9
Use raise_on_missing instead of suppress_errors
97littleleaf11 1acc7e0
make allow_missing and raise_on_missing keyword-only arg
97littleleaf11 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fix
- Loading branch information
commit 5078078220f825bb19e8c06c997f75b232ecae19
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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, | ||
|
@@ -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 | ||
|
@@ -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
|
@@ -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 | ||
|
@@ -277,7 +276,7 @@ def lookup_qualified_typeinfo(modules: Dict[str, MypyFile], name: str, | |
|
||
def lookup_qualified_alias(modules: Dict[str, MypyFile], name: str, | ||
97littleleaf11 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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 | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.