2222 from typing import _collect_type_vars , _tp_cache , _type_convert
2323
2424if TYPE_CHECKING :
25- Function = Callable [..., object ] # type: ignore[misc ]
25+ Function = Callable [..., object ] # type: ignore[dynamic ]
2626 """Any ``Callable``. useful when using mypy with ``disallow-any-explicit``
2727 due to https://github.com/python/mypy/issues/9496
2828
@@ -143,11 +143,11 @@ def _is_subclass(cls, subclass: object) -> TypeGuard[_ReifiedGenericMetaclass]:
143143 "origin" type (ie. without the generics) is a subclass of this reified generic
144144 """
145145 # could be any random instance, check it's a reified generic first:
146- return type .__instancecheck__ ( # type: ignore[misc ]
147- _ReifiedGenericMetaclass , # type: ignore[misc ]
146+ return type .__instancecheck__ ( # type: ignore[dynamic ]
147+ _ReifiedGenericMetaclass , # type: ignore[dynamic ]
148148 subclass ,
149149 # then check that the instance is an instance of this particular reified generic:
150- ) and type .__subclasscheck__ ( # type: ignore[misc ]
150+ ) and type .__subclasscheck__ ( # type: ignore[dynamic ]
151151 cls ._orig_class (),
152152 # https://github.com/python/mypy/issues/11671
153153 cast ( # pylint:disable=protected-access
@@ -204,7 +204,7 @@ def __call__(cls, *args: object, **kwargs: object) -> object:
204204 "foo = Foo[int]() # correct"
205205 )
206206 cls ._check_generics_reified ()
207- return super ().__call__ (* args , ** kwargs ) # type: ignore[misc ]
207+ return super ().__call__ (* args , ** kwargs ) # type: ignore[dynamic ]
208208
209209
210210GenericItems = Union [type , TypeVar , tuple [type | TypeVar , ...]]
@@ -248,14 +248,14 @@ class ReifiedGeneric(Generic[T], metaclass=_ReifiedGenericMetaclass):
248248 __type_vars__ : tuple [TypeVar , ...]
249249 """``TypeVar``\\ s that have not yet been reified. so this tuple should always be empty by the time the ``ReifiedGeneric`` is instantiated"""
250250
251- @_tp_cache # type: ignore[name-defined,misc]
252- def __class_getitem__ ( # type: ignore[misc ]
251+ @_tp_cache # type: ignore[name-defined,dynamic, misc]
252+ def __class_getitem__ ( # type: ignore[dynamic ]
253253 cls , item : GenericItems
254254 ) -> type [ReifiedGeneric [T ]]:
255255 # when defining the generic (ie. `class Foo(ReifiedGeneric[T]):`) we want the normal behavior
256256 if cls is ReifiedGeneric :
257257 # https://github.com/KotlinIsland/basedtypeshed/issues/7
258- return super ().__class_getitem__ (item ) # type: ignore[misc,no-any-return]
258+ return super ().__class_getitem__ (item ) # type: ignore[dynamic, misc,no-any-return]
259259
260260 items = item if isinstance (item , tuple ) else (item ,)
261261
@@ -265,7 +265,7 @@ def __class_getitem__( # type: ignore[misc]
265265 for generic in (
266266 cls .__reified_generics__ if hasattr (cls , "__reified_generics__" ) else ()
267267 )
268- if not isinstance (generic , TypeVar ) # type: ignore[misc ]
268+ if not isinstance (generic , TypeVar ) # type: ignore[dynamic ]
269269 )
270270
271271 # normal generics use __parameters__, we use __type_vars__ because the Generic base class deletes properties
@@ -295,10 +295,10 @@ def __class_getitem__( # type: ignore[misc]
295295 # TODO: proper type
296296 dict [str , object ](
297297 __reified_generics__ = tuple (
298- _type_convert (t ) for t in items # type: ignore[name-defined,misc ]
298+ _type_convert (t ) for t in items # type: ignore[name-defined,dynamic ]
299299 ),
300300 _orig_type_vars = orig_type_vars ,
301- __type_vars__ = _collect_type_vars ( # type: ignore[name-defined,misc ]
301+ __type_vars__ = _collect_type_vars ( # type: ignore[name-defined,dynamic ]
302302 items , cast (type , TypeVar )
303303 ),
304304 ),
0 commit comments