Skip to content

Commit 0ba32ad

Browse files
committed
Remove mypy suppressions of type[]
1 parent faf646e commit 0ba32ad

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/dataclass_binder/_impl.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,7 @@ def _collect_type(field_type: type, context: str) -> type | Binder[Any]:
5252
elif issubclass(field_type, str | int | float | date | time | timedelta | ModuleType | Path):
5353
return field_type
5454
elif field_type is type:
55-
# https://github.com/python/mypy/issues/13026
56-
return cast(type, type[Any]) # type: ignore[misc]
55+
return cast(type, type[Any])
5756
elif hasattr(field_type, "__class_getitem__"):
5857
raise TypeError(f"Field '{context}' needs type argument(s)")
5958
else:
@@ -100,13 +99,13 @@ def _collect_type(field_type: type, context: str) -> type | Binder[Any]:
10099
raise TypeError(f"type[...] annotation for '{context}' must have exactly one type argument") from None
101100
bases = get_args(arg) if get_origin(arg) in (UnionType, Union) else (arg,)
102101
if Any in bases:
103-
return cast(type, type[Any]) # type: ignore[misc]
102+
return cast(type, type[Any])
104103
# Convert 'type[A | B]' to 'type[A] | type[B]'.
105104
collected_types = []
106105
for base in bases:
107106
if not isinstance(base, type):
108107
raise TypeError(f"type[...] annotation for '{context}' must have a type as its argument")
109-
collected_types.append(type[base]) # type: ignore[misc]
108+
collected_types.append(type[base])
110109
return reduce(operator.__or__, collected_types)
111110
else:
112111
raise TypeError(f"Field '{context}' has unsupported generic type '{origin.__name__}'")

0 commit comments

Comments
 (0)