@@ -52,8 +52,7 @@ def _collect_type(field_type: type, context: str) -> type | Binder[Any]:
52
52
elif issubclass (field_type , str | int | float | date | time | timedelta | ModuleType | Path ):
53
53
return field_type
54
54
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 ])
57
56
elif hasattr (field_type , "__class_getitem__" ):
58
57
raise TypeError (f"Field '{ context } ' needs type argument(s)" )
59
58
else :
@@ -100,13 +99,13 @@ def _collect_type(field_type: type, context: str) -> type | Binder[Any]:
100
99
raise TypeError (f"type[...] annotation for '{ context } ' must have exactly one type argument" ) from None
101
100
bases = get_args (arg ) if get_origin (arg ) in (UnionType , Union ) else (arg ,)
102
101
if Any in bases :
103
- return cast (type , type [Any ]) # type: ignore[misc]
102
+ return cast (type , type [Any ])
104
103
# Convert 'type[A | B]' to 'type[A] | type[B]'.
105
104
collected_types = []
106
105
for base in bases :
107
106
if not isinstance (base , type ):
108
107
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 ])
110
109
return reduce (operator .__or__ , collected_types )
111
110
else :
112
111
raise TypeError (f"Field '{ context } ' has unsupported generic type '{ origin .__name__ } '" )
0 commit comments