File tree 1 file changed +5
-3
lines changed
1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -991,8 +991,9 @@ def evolve_function_sig_callback(ctx: mypy.plugin.FunctionSigContext) -> Callabl
991
991
992
992
993
993
def _get_cls_from_init (t : Type ) -> Optional [TypeInfo ]:
994
- if isinstance (t , CallableType ):
995
- return t .type_object ()
994
+ proper_type = get_proper_type (t )
995
+ if isinstance (proper_type , CallableType ):
996
+ return proper_type .type_object ()
996
997
return None
997
998
998
999
@@ -1005,7 +1006,8 @@ def fields_function_callback(ctx: FunctionContext) -> Type:
1005
1006
if MAGIC_ATTR_NAME in cls .names :
1006
1007
# This is a proper attrs class.
1007
1008
ret_type = cls .names [MAGIC_ATTR_NAME ].type
1008
- return ret_type
1009
+ if ret_type is not None :
1010
+ return ret_type
1009
1011
else :
1010
1012
ctx .api .fail (
1011
1013
f'Argument 1 to "fields" has incompatible type "{ format_type_bare (first_arg_type )} "; expected an attrs class' ,
You can’t perform that action at this time.
0 commit comments