@@ -186,7 +186,6 @@ def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
186186
187187 def _parse_a_camel_date_time (data : object ) -> Union [datetime .date , datetime .datetime ]:
188188 try :
189- a_camel_date_time_type_0 : datetime .datetime
190189 if not isinstance (data , str ):
191190 raise TypeError ()
192191 a_camel_date_time_type_0 = isoparse (data )
@@ -196,7 +195,6 @@ def _parse_a_camel_date_time(data: object) -> Union[datetime.date, datetime.date
196195 pass
197196 if not isinstance (data , str ):
198197 raise TypeError ()
199- a_camel_date_time_type_1 : datetime .date
200198 a_camel_date_time_type_1 = isoparse (data ).date ()
201199
202200 return a_camel_date_time_type_1
@@ -209,7 +207,6 @@ def _parse_a_camel_date_time(data: object) -> Union[datetime.date, datetime.date
209207
210208 def _parse_one_of_models (data : object ) -> Union [FreeFormModel , ModelWithUnionProperty ]:
211209 try :
212- one_of_models_type_0 : FreeFormModel
213210 if not isinstance (data , dict ):
214211 raise TypeError ()
215212 one_of_models_type_0 = FreeFormModel .from_dict (data )
@@ -219,7 +216,6 @@ def _parse_one_of_models(data: object) -> Union[FreeFormModel, ModelWithUnionPro
219216 pass
220217 if not isinstance (data , dict ):
221218 raise TypeError ()
222- one_of_models_type_1 : ModelWithUnionProperty
223219 one_of_models_type_1 = ModelWithUnionProperty .from_dict (data )
224220
225221 return one_of_models_type_1
@@ -228,9 +224,11 @@ def _parse_one_of_models(data: object) -> Union[FreeFormModel, ModelWithUnionPro
228224
229225 model = ModelWithUnionProperty .from_dict (d .pop ("model" ))
230226
231- an_optional_allof_enum : Union [Unset , AnAllOfEnum ] = UNSET
232227 _an_optional_allof_enum = d .pop ("an_optional_allof_enum" , UNSET )
233- if not isinstance (_an_optional_allof_enum , Unset ):
228+ an_optional_allof_enum : Union [Unset , AnAllOfEnum ]
229+ if isinstance (_an_optional_allof_enum , Unset ):
230+ an_optional_allof_enum = UNSET
231+ else :
234232 an_optional_allof_enum = AnAllOfEnum (_an_optional_allof_enum )
235233
236234 nested_list_of_enums = []
@@ -245,14 +243,18 @@ def _parse_one_of_models(data: object) -> Union[FreeFormModel, ModelWithUnionPro
245243
246244 nested_list_of_enums .append (nested_list_of_enums_item )
247245
248- a_nullable_date = None
249246 _a_nullable_date = d .pop ("a_nullable_date" )
250- if _a_nullable_date is not None :
247+ a_nullable_date : Optional [datetime .date ]
248+ if _a_nullable_date is None :
249+ a_nullable_date = None
250+ else :
251251 a_nullable_date = isoparse (_a_nullable_date ).date ()
252252
253- a_not_required_date : Union [Unset , datetime .date ] = UNSET
254253 _a_not_required_date = d .pop ("a_not_required_date" , UNSET )
255- if not isinstance (_a_not_required_date , Unset ):
254+ a_not_required_date : Union [Unset , datetime .date ]
255+ if isinstance (_a_not_required_date , Unset ):
256+ a_not_required_date = UNSET
257+ else :
256258 a_not_required_date = isoparse (_a_not_required_date ).date ()
257259
258260 attr_1_leading_digit = d .pop ("1_leading_digit" , UNSET )
@@ -267,7 +269,6 @@ def _parse_nullable_one_of_models(data: object) -> Union[FreeFormModel, ModelWit
267269 if data is None :
268270 return data
269271 try :
270- nullable_one_of_models_type_0 : FreeFormModel
271272 if not isinstance (data , dict ):
272273 raise TypeError ()
273274 nullable_one_of_models_type_0 = FreeFormModel .from_dict (data )
@@ -277,7 +278,6 @@ def _parse_nullable_one_of_models(data: object) -> Union[FreeFormModel, ModelWit
277278 pass
278279 if not isinstance (data , dict ):
279280 raise TypeError ()
280- nullable_one_of_models_type_1 : ModelWithUnionProperty
281281 nullable_one_of_models_type_1 = ModelWithUnionProperty .from_dict (data )
282282
283283 return nullable_one_of_models_type_1
@@ -288,23 +288,25 @@ def _parse_not_required_one_of_models(data: object) -> Union[FreeFormModel, Mode
288288 if isinstance (data , Unset ):
289289 return data
290290 try :
291- not_required_one_of_models_type_0 : Union [Unset , FreeFormModel ]
292291 if not isinstance (data , dict ):
293292 raise TypeError ()
294- not_required_one_of_models_type_0 = UNSET
295293 _not_required_one_of_models_type_0 = data
296- if not isinstance (_not_required_one_of_models_type_0 , Unset ):
294+ not_required_one_of_models_type_0 : Union [Unset , FreeFormModel ]
295+ if isinstance (_not_required_one_of_models_type_0 , Unset ):
296+ not_required_one_of_models_type_0 = UNSET
297+ else :
297298 not_required_one_of_models_type_0 = FreeFormModel .from_dict (_not_required_one_of_models_type_0 )
298299
299300 return not_required_one_of_models_type_0
300301 except : # noqa: E722
301302 pass
302303 if not isinstance (data , dict ):
303304 raise TypeError ()
304- not_required_one_of_models_type_1 : Union [Unset , ModelWithUnionProperty ]
305- not_required_one_of_models_type_1 = UNSET
306305 _not_required_one_of_models_type_1 = data
307- if not isinstance (_not_required_one_of_models_type_1 , Unset ):
306+ not_required_one_of_models_type_1 : Union [Unset , ModelWithUnionProperty ]
307+ if isinstance (_not_required_one_of_models_type_1 , Unset ):
308+ not_required_one_of_models_type_1 = UNSET
309+ else :
308310 not_required_one_of_models_type_1 = ModelWithUnionProperty .from_dict (_not_required_one_of_models_type_1 )
309311
310312 return not_required_one_of_models_type_1
@@ -319,12 +321,13 @@ def _parse_not_required_nullable_one_of_models(
319321 if isinstance (data , Unset ):
320322 return data
321323 try :
322- not_required_nullable_one_of_models_type_0 : Union [Unset , FreeFormModel ]
323324 if not isinstance (data , dict ):
324325 raise TypeError ()
325- not_required_nullable_one_of_models_type_0 = UNSET
326326 _not_required_nullable_one_of_models_type_0 = data
327- if not isinstance (_not_required_nullable_one_of_models_type_0 , Unset ):
327+ not_required_nullable_one_of_models_type_0 : Union [Unset , FreeFormModel ]
328+ if isinstance (_not_required_nullable_one_of_models_type_0 , Unset ):
329+ not_required_nullable_one_of_models_type_0 = UNSET
330+ else :
328331 not_required_nullable_one_of_models_type_0 = FreeFormModel .from_dict (
329332 _not_required_nullable_one_of_models_type_0
330333 )
@@ -333,12 +336,13 @@ def _parse_not_required_nullable_one_of_models(
333336 except : # noqa: E722
334337 pass
335338 try :
336- not_required_nullable_one_of_models_type_1 : Union [Unset , ModelWithUnionProperty ]
337339 if not isinstance (data , dict ):
338340 raise TypeError ()
339- not_required_nullable_one_of_models_type_1 = UNSET
340341 _not_required_nullable_one_of_models_type_1 = data
341- if not isinstance (_not_required_nullable_one_of_models_type_1 , Unset ):
342+ not_required_nullable_one_of_models_type_1 : Union [Unset , ModelWithUnionProperty ]
343+ if isinstance (_not_required_nullable_one_of_models_type_1 , Unset ):
344+ not_required_nullable_one_of_models_type_1 = UNSET
345+ else :
342346 not_required_nullable_one_of_models_type_1 = ModelWithUnionProperty .from_dict (
343347 _not_required_nullable_one_of_models_type_1
344348 )
@@ -352,19 +356,27 @@ def _parse_not_required_nullable_one_of_models(
352356 d .pop ("not_required_nullable_one_of_models" , UNSET )
353357 )
354358
355- nullable_model = None
356359 _nullable_model = d .pop ("nullable_model" )
357- if _nullable_model is not None :
360+ nullable_model : Optional [ModelWithUnionProperty ]
361+ if _nullable_model is None :
362+ nullable_model = None
363+ else :
358364 nullable_model = ModelWithUnionProperty .from_dict (_nullable_model )
359365
360- not_required_model : Union [Unset , ModelWithUnionProperty ] = UNSET
361366 _not_required_model = d .pop ("not_required_model" , UNSET )
362- if not isinstance (_not_required_model , Unset ):
367+ not_required_model : Union [Unset , ModelWithUnionProperty ]
368+ if isinstance (_not_required_model , Unset ):
369+ not_required_model = UNSET
370+ else :
363371 not_required_model = ModelWithUnionProperty .from_dict (_not_required_model )
364372
365- not_required_nullable_model = None
366373 _not_required_nullable_model = d .pop ("not_required_nullable_model" , UNSET )
367- if _not_required_nullable_model is not None and not isinstance (_not_required_nullable_model , Unset ):
374+ not_required_nullable_model : Union [Unset , None , ModelWithUnionProperty ]
375+ if _not_required_nullable_model is None :
376+ not_required_nullable_model = None
377+ elif isinstance (_not_required_nullable_model , Unset ):
378+ not_required_nullable_model = UNSET
379+ else :
368380 not_required_nullable_model = ModelWithUnionProperty .from_dict (_not_required_nullable_model )
369381
370382 a_model = cls (
0 commit comments