@@ -65,9 +65,9 @@ def map_value(self, value: str | dict[str, Any]):
6565@dataclasses .dataclass
6666class DataclassField (Field ):
6767 @classmethod
68- def collect (cls , typ : type , type_hints : dict [str , Type ]) -> list [Self ]:
68+ def collect (cls , value : type , type_hints : dict [str , Type ]) -> list [Self ]:
6969 fields = []
70- for f in typ .__dataclass_fields__ .values (): # type: ignore
70+ for f in value .__dataclass_fields__ .values (): # type: ignore
7171 annotation = get_type (type_hints [f .name ])
7272
7373 annotation , args = get_annotation_args (annotation )
@@ -85,10 +85,10 @@ def collect(cls, typ: type, type_hints: dict[str, Type]) -> list[Self]:
8585@dataclasses .dataclass
8686class AttrsField (Field ):
8787 @classmethod
88- def collect (cls , typ : type , type_hints : dict [str , Type ]) -> list [Self ]:
88+ def collect (cls , value : type , type_hints : dict [str , Type ]) -> list [Self ]:
8989 fields = []
9090
91- for f in typ .__attrs_attrs__ : # type: ignore
91+ for f in value .__attrs_attrs__ : # type: ignore
9292 annotation = get_type (type_hints [f .name ])
9393 annotation , args = get_annotation_args (annotation )
9494
@@ -105,11 +105,11 @@ def collect(cls, typ: type, type_hints: dict[str, Type]) -> list[Self]:
105105@dataclasses .dataclass
106106class MsgspecField (Field ):
107107 @classmethod
108- def collect (cls , typ : type , type_hints : dict [str , Type ]) -> list [Self ]:
108+ def collect (cls , value : type , type_hints : dict [str , Type ]) -> list [Self ]:
109109 import msgspec
110110
111111 fields = []
112- for f in msgspec .structs .fields (typ ):
112+ for f in msgspec .structs .fields (value ):
113113 annotation = get_type (type_hints [f .name ])
114114 annotation , args = get_annotation_args (annotation )
115115
@@ -137,9 +137,9 @@ def convert(**value):
137137@dataclasses .dataclass
138138class PydanticV1Field (Field ):
139139 @classmethod
140- def collect (cls , typ , type_hints : dict [str , Type ]) -> list [Self ]:
140+ def collect (cls , value , type_hints : dict [str , Type ]) -> list [Self ]:
141141 fields = []
142- for name , f in typ .__fields__ .items ():
142+ for name , f in value .__fields__ .items ():
143143 annotation = get_type (type_hints [name ])
144144 annotation , args = get_annotation_args (annotation )
145145
@@ -158,9 +158,9 @@ def collect(cls, typ, type_hints: dict[str, Type]) -> list[Self]:
158158@dataclasses .dataclass
159159class PydanticV2Field (Field ):
160160 @classmethod
161- def collect (cls , typ : type , type_hints : dict [str , Type ]) -> list [Self ]:
161+ def collect (cls , value : type , type_hints : dict [str , Type ]) -> list [Self ]:
162162 fields = []
163- for name , f in typ .model_fields .items (): # type: ignore
163+ for name , f in value .model_fields .items (): # type: ignore
164164 annotation = get_type (type_hints [name ])
165165 mapper = annotation if detect (annotation ) else None
166166
@@ -177,10 +177,10 @@ def collect(cls, typ: type, type_hints: dict[str, Type]) -> list[Self]:
177177@dataclasses .dataclass
178178class PydanticV2DataclassField (Field ):
179179 @classmethod
180- def collect (cls , typ : type , type_hints : dict [str , Type ]) -> list [Self ]:
180+ def collect (cls , value : type , type_hints : dict [str , Type ]) -> list [Self ]:
181181 fields = []
182182
183- for name , f in typ .__pydantic_fields__ .items (): # type: ignore
183+ for name , f in value .__pydantic_fields__ .items (): # type: ignore
184184 annotation = get_type (type_hints [name ])
185185 mapper = annotation if detect (annotation ) else None
186186
@@ -248,10 +248,10 @@ def from_cls(cls, obj: type) -> ClassTypes | None:
248248 return None
249249
250250
251- def get_type (typ ):
252- if typing_inspect .is_optional_type (typ ):
253- return get_args (typ )[0 ]
254- return typ
251+ def get_type (value ):
252+ if typing_inspect .is_optional_type (value ):
253+ return get_args (value )[0 ]
254+ return value
255255
256256
257257def get_annotation_args (annotation ) -> Tuple [Type , Tuple [Any , ...]]:
0 commit comments