Skip to content

Commit

Permalink
Fix proper_plugin for typeshed tuple change (#12319)
Browse files Browse the repository at this point in the history
This will be broken by python/typeshed#7454

Co-authored-by: hauntsaninja <>
  • Loading branch information
hauntsaninja committed Mar 9, 2022
1 parent 18c32da commit 47e2ca8
Showing 1 changed file with 2 additions and 2 deletions.
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

0 comments on commit 47e2ca8

Please sign in to comment.