@@ -22,6 +22,7 @@ from _typeshed import (
2222 SupportsTrunc ,
2323 SupportsWrite ,
2424)
25+ from collections .abc import Callable
2526from io import BufferedRandom , BufferedReader , BufferedWriter , FileIO , TextIOWrapper
2627from types import CodeType , TracebackType , _Cell
2728from typing import (
@@ -30,7 +31,6 @@ from typing import (
3031 Any ,
3132 BinaryIO ,
3233 ByteString ,
33- Callable ,
3434 Generic ,
3535 Iterable ,
3636 Iterator ,
@@ -61,6 +61,7 @@ if sys.version_info >= (3, 9):
6161_T = TypeVar ("_T" )
6262_T_co = TypeVar ("_T_co" , covariant = True )
6363_T_contra = TypeVar ("_T_contra" , contravariant = True )
64+ _R_co = TypeVar ("_R_co" , covariant = True )
6465_KT = TypeVar ("_KT" )
6566_VT = TypeVar ("_VT" )
6667_S = TypeVar ("_S" )
@@ -69,7 +70,6 @@ _T2 = TypeVar("_T2")
6970_T3 = TypeVar ("_T3" )
7071_T4 = TypeVar ("_T4" )
7172_T5 = TypeVar ("_T5" )
72- _R = TypeVar ("_R" ) # Return-type TypeVar
7373_SupportsNextT = TypeVar ("_SupportsNextT" , bound = SupportsNext [Any ], covariant = True )
7474_SupportsAnextT = TypeVar ("_SupportsAnextT" , bound = SupportsAnext [Any ], covariant = True )
7575
@@ -112,26 +112,26 @@ class object:
112112 def __dir__ (self ) -> Iterable [str ]: ...
113113 def __init_subclass__ (cls ) -> None : ...
114114
115- class staticmethod (Generic [_R ]):
116- __func__ : Callable [..., _R ]
115+ class staticmethod (Generic [_R_co ]):
116+ __func__ : Callable [..., _R_co ]
117117 __isabstractmethod__ : bool
118- def __init__ (self : staticmethod [_R ], __f : Callable [..., _R ]) -> None : ...
119- def __get__ (self , __obj : _T , __type : type [_T ] | None = ...) -> Callable [..., _R ]: ...
118+ def __init__ (self : staticmethod [_R_co ], __f : Callable [..., _R_co ]) -> None : ...
119+ def __get__ (self , __obj : _T , __type : type [_T ] | None = ...) -> Callable [..., _R_co ]: ...
120120 if sys .version_info >= (3 , 10 ):
121121 __name__ : str
122122 __qualname__ : str
123- __wrapped__ : Callable [..., _R ]
124- def __call__ (self , * args : Any , ** kwargs : Any ) -> _R : ...
123+ __wrapped__ : Callable [..., _R_co ]
124+ def __call__ (self , * args : Any , ** kwargs : Any ) -> _R_co : ...
125125
126- class classmethod (Generic [_R ]):
127- __func__ : Callable [..., _R ]
126+ class classmethod (Generic [_R_co ]):
127+ __func__ : Callable [..., _R_co ]
128128 __isabstractmethod__ : bool
129- def __init__ (self : classmethod [_R ], __f : Callable [..., _R ]) -> None : ...
130- def __get__ (self , __obj : _T , __type : type [_T ] | None = ...) -> Callable [..., _R ]: ...
129+ def __init__ (self : classmethod [_R_co ], __f : Callable [..., _R_co ]) -> None : ...
130+ def __get__ (self , __obj : _T , __type : type [_T ] | None = ...) -> Callable [..., _R_co ]: ...
131131 if sys .version_info >= (3 , 10 ):
132132 __name__ : str
133133 __qualname__ : str
134- __wrapped__ : Callable [..., _R ]
134+ __wrapped__ : Callable [..., _R_co ]
135135
136136class type :
137137 __base__ : type
0 commit comments