@@ -186,7 +186,6 @@ def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
186
186
187
187
def _parse_a_camel_date_time (data : object ) -> Union [datetime .date , datetime .datetime ]:
188
188
try :
189
- a_camel_date_time_type_0 : datetime .datetime
190
189
if not isinstance (data , str ):
191
190
raise TypeError ()
192
191
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
196
195
pass
197
196
if not isinstance (data , str ):
198
197
raise TypeError ()
199
- a_camel_date_time_type_1 : datetime .date
200
198
a_camel_date_time_type_1 = isoparse (data ).date ()
201
199
202
200
return a_camel_date_time_type_1
@@ -209,7 +207,6 @@ def _parse_a_camel_date_time(data: object) -> Union[datetime.date, datetime.date
209
207
210
208
def _parse_one_of_models (data : object ) -> Union [FreeFormModel , ModelWithUnionProperty ]:
211
209
try :
212
- one_of_models_type_0 : FreeFormModel
213
210
if not isinstance (data , dict ):
214
211
raise TypeError ()
215
212
one_of_models_type_0 = FreeFormModel .from_dict (data )
@@ -219,7 +216,6 @@ def _parse_one_of_models(data: object) -> Union[FreeFormModel, ModelWithUnionPro
219
216
pass
220
217
if not isinstance (data , dict ):
221
218
raise TypeError ()
222
- one_of_models_type_1 : ModelWithUnionProperty
223
219
one_of_models_type_1 = ModelWithUnionProperty .from_dict (data )
224
220
225
221
return one_of_models_type_1
@@ -228,9 +224,11 @@ def _parse_one_of_models(data: object) -> Union[FreeFormModel, ModelWithUnionPro
228
224
229
225
model = ModelWithUnionProperty .from_dict (d .pop ("model" ))
230
226
231
- an_optional_allof_enum : Union [Unset , AnAllOfEnum ] = UNSET
232
227
_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 :
234
232
an_optional_allof_enum = AnAllOfEnum (_an_optional_allof_enum )
235
233
236
234
nested_list_of_enums = []
@@ -245,14 +243,18 @@ def _parse_one_of_models(data: object) -> Union[FreeFormModel, ModelWithUnionPro
245
243
246
244
nested_list_of_enums .append (nested_list_of_enums_item )
247
245
248
- a_nullable_date = None
249
246
_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 :
251
251
a_nullable_date = isoparse (_a_nullable_date ).date ()
252
252
253
- a_not_required_date : Union [Unset , datetime .date ] = UNSET
254
253
_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 :
256
258
a_not_required_date = isoparse (_a_not_required_date ).date ()
257
259
258
260
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
267
269
if data is None :
268
270
return data
269
271
try :
270
- nullable_one_of_models_type_0 : FreeFormModel
271
272
if not isinstance (data , dict ):
272
273
raise TypeError ()
273
274
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
277
278
pass
278
279
if not isinstance (data , dict ):
279
280
raise TypeError ()
280
- nullable_one_of_models_type_1 : ModelWithUnionProperty
281
281
nullable_one_of_models_type_1 = ModelWithUnionProperty .from_dict (data )
282
282
283
283
return nullable_one_of_models_type_1
@@ -288,23 +288,25 @@ def _parse_not_required_one_of_models(data: object) -> Union[FreeFormModel, Mode
288
288
if isinstance (data , Unset ):
289
289
return data
290
290
try :
291
- not_required_one_of_models_type_0 : Union [Unset , FreeFormModel ]
292
291
if not isinstance (data , dict ):
293
292
raise TypeError ()
294
- not_required_one_of_models_type_0 = UNSET
295
293
_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 :
297
298
not_required_one_of_models_type_0 = FreeFormModel .from_dict (_not_required_one_of_models_type_0 )
298
299
299
300
return not_required_one_of_models_type_0
300
301
except : # noqa: E722
301
302
pass
302
303
if not isinstance (data , dict ):
303
304
raise TypeError ()
304
- not_required_one_of_models_type_1 : Union [Unset , ModelWithUnionProperty ]
305
- not_required_one_of_models_type_1 = UNSET
306
305
_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 :
308
310
not_required_one_of_models_type_1 = ModelWithUnionProperty .from_dict (_not_required_one_of_models_type_1 )
309
311
310
312
return not_required_one_of_models_type_1
@@ -319,12 +321,13 @@ def _parse_not_required_nullable_one_of_models(
319
321
if isinstance (data , Unset ):
320
322
return data
321
323
try :
322
- not_required_nullable_one_of_models_type_0 : Union [Unset , FreeFormModel ]
323
324
if not isinstance (data , dict ):
324
325
raise TypeError ()
325
- not_required_nullable_one_of_models_type_0 = UNSET
326
326
_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 :
328
331
not_required_nullable_one_of_models_type_0 = FreeFormModel .from_dict (
329
332
_not_required_nullable_one_of_models_type_0
330
333
)
@@ -333,12 +336,13 @@ def _parse_not_required_nullable_one_of_models(
333
336
except : # noqa: E722
334
337
pass
335
338
try :
336
- not_required_nullable_one_of_models_type_1 : Union [Unset , ModelWithUnionProperty ]
337
339
if not isinstance (data , dict ):
338
340
raise TypeError ()
339
- not_required_nullable_one_of_models_type_1 = UNSET
340
341
_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 :
342
346
not_required_nullable_one_of_models_type_1 = ModelWithUnionProperty .from_dict (
343
347
_not_required_nullable_one_of_models_type_1
344
348
)
@@ -352,19 +356,27 @@ def _parse_not_required_nullable_one_of_models(
352
356
d .pop ("not_required_nullable_one_of_models" , UNSET )
353
357
)
354
358
355
- nullable_model = None
356
359
_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 :
358
364
nullable_model = ModelWithUnionProperty .from_dict (_nullable_model )
359
365
360
- not_required_model : Union [Unset , ModelWithUnionProperty ] = UNSET
361
366
_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 :
363
371
not_required_model = ModelWithUnionProperty .from_dict (_not_required_model )
364
372
365
- not_required_nullable_model = None
366
373
_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 :
368
380
not_required_nullable_model = ModelWithUnionProperty .from_dict (_not_required_nullable_model )
369
381
370
382
a_model = cls (
0 commit comments