4141 Member ,
4242 Members ,
4343 NewProtocol ,
44- Overloaded ,
4544 Param ,
4645 RaiseError ,
4746 Slice ,
@@ -154,35 +153,12 @@ def get_annotated_method_hints(cls, *, ctx):
154153
155154 _ , dct = _apply_generic .get_local_defns (abox )
156155 for name , attr in dct .items ():
157- if isinstance (
156+ hints [ name ] = (
158157 attr ,
159- (
160- types .FunctionType ,
161- types .MethodType ,
162- staticmethod ,
163- classmethod ,
164- ),
165- ):
166- if attr is typing ._no_init_or_replace_init :
167- continue
168-
169- hints [name ] = (
170- _function_type (attr , receiver_type = acls ),
171- ("ClassVar" ,),
172- object ,
173- acls ,
174- )
175- elif isinstance (attr , _apply_generic .WrappedOverloads ):
176- overloads = [
177- _function_type (_eval_types (of , ctx ), receiver_type = acls )
178- for of in attr .functions
179- ]
180- hints [name ] = (
181- Overloaded [* overloads ],
182- ("ClassVar" ,),
183- object ,
184- acls ,
185- )
158+ ("ClassVar" ,),
159+ object ,
160+ acls ,
161+ )
186162
187163 return hints
188164
@@ -763,7 +739,9 @@ def _ann(x):
763739 return f
764740
765741
766- def _function_type (func , * , receiver_type ):
742+ def _function_type (
743+ func , * , receiver_type
744+ ) -> type [typing .Callable | classmethod | staticmethod | GenericCallable ]:
767745 root = inspect .unwrap (func )
768746 sig = inspect .signature (root )
769747 f = _function_type_from_sig (sig , func , receiver_type = receiver_type )
@@ -772,7 +750,7 @@ def _function_type(func, *, receiver_type):
772750 # Must store a lambda that performs type variable substitution
773751 type_params = root .__type_params__
774752 callable_lambda = _create_generic_callable_lambda (f , type_params )
775- f = GenericCallable [tuple [* type_params ], callable_lambda ]
753+ f = GenericCallable [tuple [* type_params ], callable_lambda ] # type: ignore[misc,valid-type]
776754 return f
777755
778756
0 commit comments