Skip to content

Fix proper_plugin for typeshed tuple change #12319

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 1 commit into from
Mar 9, 2022
Merged
Changes from all commits
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
4 changes: 2 additions & 2 deletions misc/proper_plugin.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from mypy.plugin import Plugin, FunctionContext
from mypy.types import (
Type, Instance, CallableType, UnionType, get_proper_type, ProperType,
FunctionLike, Type, Instance, CallableType, UnionType, get_proper_type, ProperType,
get_proper_types, TupleType, NoneTyp, AnyType
)
from mypy.nodes import TypeInfo
Expand Down Expand Up @@ -52,7 +52,7 @@ def isinstance_proper_hook(ctx: FunctionContext) -> Type:

def is_special_target(right: ProperType) -> bool:
"""Whitelist some special cases for use in isinstance() with improper types."""
if isinstance(right, CallableType) and right.is_type_obj():
if isinstance(right, FunctionLike) and right.is_type_obj():
if right.type_object().fullname == 'builtins.tuple':
# Used with Union[Type, Tuple[Type, ...]].
return True
Expand Down