Skip to content

Commit e6d74cd

Browse files
committed
Fix missing type parameters for Callable
1 parent 4818e29 commit e6d74cd

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

classes/_typeclass.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,12 @@
119119
from functools import _find_impl # type: ignore # noqa: WPS450
120120
from typing import ( # noqa: WPS235
121121
TYPE_CHECKING,
122+
Any,
122123
Callable,
123124
Dict,
124125
Generic,
125126
Optional,
127+
Protocol,
126128
Type,
127129
TypeVar,
128130
Union,
@@ -298,6 +300,10 @@ class Supports(Generic[_AssociatedTypeDef]):
298300
__slots__ = ()
299301

300302

303+
class Callback(Protocol):
304+
def __call__(self, instance, *args, **kwargs) -> _ReturnType: ...
305+
306+
301307
@final # noqa: WPS214
302308
class _TypeClass( # noqa: WPS214
303309
Generic[_InstanceType, _SignatureType, _AssociatedType, _Fullname],
@@ -323,7 +329,7 @@ class _TypeClass( # noqa: WPS214
323329
'_dispatch_cache',
324330
)
325331

326-
_dispatch_cache: Dict[type, Callable]
332+
_dispatch_cache: Dict[type, Callback]
327333
_cache_token: Optional[object]
328334

329335
def __init__(
@@ -601,7 +607,7 @@ def _dispatch(self, instance, instance_type: type) -> Optional[Callable]:
601607

602608
return _find_impl(instance_type, self._exact_types)
603609

604-
def _dispatch_delegate(self, instance) -> Optional[Callable]:
610+
def _dispatch_delegate(self, instance) -> Optional[Callback]:
605611
for delegate, callback in self._delegates.items():
606612
if isinstance(instance, delegate):
607613
return callback

0 commit comments

Comments
 (0)