8000 [very much a wip] pep 612 by hauntsaninja · Pull Request #9250 · python/mypy · GitHub
[go: up one dir, main page]

Skip to content

[very much a wip] pep 612 #9250

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

Closed
wants to merge 19 commits into from
Closed
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
Next Next commit
mypy: [minor] use get_type_vars
  • Loading branch information
hauntsaninja committed Aug 1, 2020
commit 6da27daf732a8f9a537923ccdfcfc5a37a15543e
6 changes: 3 additions & 3 deletions mypy/checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
erase_def_to_union_or_bound, erase_to_union_or_bound, coerce_to_literal,
try_getting_str_literals_from_type, try_getting_int_literals_from_type,
tuple_fallback, is_singleton_type, try_expanding_enum_to_union,
true_only, false_only, function_type, TypeVarExtractor, custom_special_method,
true_only, false_only, function_type, get_type_vars, custom_special_method,
is_literal_type_like,
)
from mypy import message_registry
Expand Down Expand Up @@ -5325,7 +5325,7 @@ def detach_callable(typ: CallableType) -> CallableType:

appear_map = {} # type: Dict[str, List[int]]
for i, inner_type in enumerate(type_list):
typevars_available = inner_type.accept(TypeVarExtractor())
typevars_available = get_type_vars(inner_type)
for var in typevars_available:
if var.fullname not in appear_map:
appear_map[var.fullname] = []
Expand All @@ -5335,7 +5335,7 @@ def detach_callable(typ: CallableType) -> CallableType:
for var_name, appearances in appear_map.items():
used_type_var_names.add(var_name)

all_type_vars = typ.accept(TypeVarExtractor())
all_type_vars = get_type_vars(typ)
new_variables = []
for var in set(all_type_vars):
if var.fullname not in used_type_var_names:
Expand Down
0