Skip to content

Commit 58a1d3d

Browse files
committed
Fix: Add exception handling and resolve issues caused by AnyType and Add return type
1 parent c375805 commit 58a1d3d

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

mypy/plugins/attrs.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,7 +1022,7 @@ def add_method(
10221022
)
10231023

10241024

1025-
def _get_attrs_init_type(typ: Instance) -> CallableType | None:
1025+
def _get_attrs_init_type(typ: Instance) -> CallableType | None | AnyType:
10261026
"""
10271027
If `typ` refers to an attrs class, get the type of its initializer method.
10281028
"""
@@ -1032,7 +1032,6 @@ def _get_attrs_init_type(typ: Instance) -> CallableType | None:
10321032
init_method = typ.type.get_method("__init__") or typ.type.get_method(ATTRS_INIT_NAME)
10331033
if init_method is None:
10341034
return None
1035-
10361035
# case 1: normal FuncDef
10371036
if isinstance(init_method, FuncDef) and isinstance(init_method.type, CallableType):
10381037
return init_method.type

0 commit comments

Comments
 (0)