11import sys
2- from abc import abstractmethod
2+ from abc import ABCMeta , abstractmethod
33from types import MappingProxyType
44from typing import ( # noqa: Y022,Y038,UP035,Y057
55 AbstractSet as Set ,
@@ -8,7 +8,6 @@ from typing import ( # noqa: Y022,Y038,UP035,Y057
88 AsyncIterator as AsyncIterator ,
99 Awaitable as Awaitable ,
1010 ByteString as ByteString ,
11- Callable as Callable ,
1211 ClassVar ,
1312 Collection as Collection ,
1413 Container as Container ,
@@ -25,6 +24,7 @@ from typing import ( # noqa: Y022,Y038,UP035,Y057
2524 MutableMapping as MutableMapping ,
2625 MutableSequence as MutableSequence ,
2726 MutableSet as MutableSet ,
27+ ParamSpec ,
2828 Protocol ,
2929 Reversible as Reversible ,
3030 Sequence as Sequence ,
@@ -68,6 +68,17 @@ if sys.version_info >= (3, 12):
6868_KT_co = TypeVar ("_KT_co" , covariant = True ) # Key type covariant containers.
6969_VT_co = TypeVar ("_VT_co" , covariant = True ) # Value type covariant containers.
7070
71+ _R_co = TypeVar ("_R_co" , covariant = True ) # return type for Callable
72+ _P = ParamSpec ("_P" )
73+
74+ @runtime_checkable
75+ class Callable (Protocol [_P , _R_co ], metaclass = ABCMeta ):
76+
77+ __slots__ = ()
78+
79+ @abstractmethod
80+ def __call__ (self , * args : _P .args , ** kwargs : _P .kwargs ) -> _R_co : ...
81+
7182@final
7283class dict_keys (KeysView [_KT_co ], Generic [_KT_co , _VT_co ]): # undocumented
7384 def __eq__ (self , value : object , / ) -> bool : ...
0 commit comments