@@ -151,20 +151,25 @@ class partialmethod(Generic[_T]):
151151 if sys .version_info >= (3 , 9 ):
152152 def __class_getitem__ (cls , item : Any , / ) -> GenericAlias : ...
153153
154+ if sys .version_info >= (3 , 11 ):
155+ _RegType : TypeAlias = type [Any ] | types .UnionType
156+ else :
157+ _RegType : TypeAlias = type [Any ]
158+
154159class _SingleDispatchCallable (Generic [_T ]):
155160 registry : types .MappingProxyType [Any , Callable [..., _T ]]
156161 def dispatch (self , cls : Any ) -> Callable [..., _T ]: ...
157162 # @fun.register(complex)
158163 # def _(arg, verbose=False): ...
159164 @overload
160- def register (self , cls : type [ Any ] , func : None = None ) -> Callable [[Callable [..., _T ]], Callable [..., _T ]]: ...
165+ def register (self , cls : _RegType , func : None = None ) -> Callable [[Callable [..., _T ]], Callable [..., _T ]]: ...
161166 # @fun.register
162167 # def _(arg: int, verbose=False):
163168 @overload
164169 def register (self , cls : Callable [..., _T ], func : None = None ) -> Callable [..., _T ]: ...
165170 # fun.register(int, lambda x: x)
166171 @overload
167- def register (self , cls : type [ Any ] , func : Callable [..., _T ]) -> Callable [..., _T ]: ...
172+ def register (self , cls : _RegType , func : Callable [..., _T ]) -> Callable [..., _T ]: ...
168173 def _clear_cache (self ) -> None : ...
169174 def __call__ (self , / , * args : Any , ** kwargs : Any ) -> _T : ...
170175
@@ -177,11 +182,11 @@ class singledispatchmethod(Generic[_T]):
177182 @property
178183 def __isabstractmethod__ (self ) -> bool : ...
179184 @overload
180- def register (self , cls : type [ Any ] , method : None = None ) -> Callable [[Callable [..., _T ]], Callable [..., _T ]]: ...
185+ def register (self , cls : _RegType , method : None = None ) -> Callable [[Callable [..., _T ]], Callable [..., _T ]]: ...
181186 @overload
182187 def register (self , cls : Callable [..., _T ], method : None = None ) -> Callable [..., _T ]: ...
183188 @overload
184- def register (self , cls : type [ Any ] , method : Callable [..., _T ]) -> Callable [..., _T ]: ...
189+ def register (self , cls : _RegType , method : Callable [..., _T ]) -> Callable [..., _T ]: ...
185190 def __get__ (self , obj : _S , cls : type [_S ] | None = None ) -> Callable [..., _T ]: ...
186191
187192class cached_property (Generic [_T_co ]):
0 commit comments