Skip to content

Commit 9c00256

Browse files
Revert changes to Unset
1 parent 915d7c3 commit 9c00256

22 files changed

+89
-73
lines changed

end_to_end_tests/golden-record-custom/custom_e2e/models/a_model.py

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ def _parse_one_of_models(data: Union[Dict[str, Any]]) -> Union[FreeFormModel, Mo
223223

224224
a_nullable_date = None
225225
_a_nullable_date = d.pop("a_nullable_date")
226-
if _a_nullable_date is not None and not isinstance(_a_nullable_date, Unset):
226+
if _a_nullable_date is not None:
227227
a_nullable_date = isoparse(cast(str, _a_nullable_date)).date()
228228

229229
attr_1_leading_digit = d.pop("1_leading_digit", UNSET)
@@ -235,20 +235,19 @@ def _parse_one_of_models(data: Union[Dict[str, Any]]) -> Union[FreeFormModel, Mo
235235
not_required_not_nullable = d.pop("not_required_not_nullable", UNSET)
236236

237237
nullable_model = None
238-
if d.pop("nullable_model") is not None and not isinstance(d.pop("nullable_model"), Unset):
239-
nullable_model = AModelNullableModel.from_dict(d.pop("nullable_model"))
238+
_nullable_model = d.pop("nullable_model")
239+
if _nullable_model is not None:
240+
nullable_model = AModelNullableModel.from_dict(_nullable_model)
240241

241242
not_required_model: Union[Unset, AModelNotRequiredModel] = UNSET
242-
if d.pop("not_required_model", UNSET) is not None and not isinstance(d.pop("not_required_model", UNSET), Unset):
243-
not_required_model = AModelNotRequiredModel.from_dict(d.pop("not_required_model", UNSET))
243+
_not_required_model = d.pop("not_required_model", UNSET)
244+
if not isinstance(_not_required_model, Unset):
245+
not_required_model = AModelNotRequiredModel.from_dict(_not_required_model)
244246

245247
not_required_nullable_model = None
246-
if d.pop("not_required_nullable_model", UNSET) is not None and not isinstance(
247-
d.pop("not_required_nullable_model", UNSET), Unset
248-
):
249-
not_required_nullable_model = AModelNotRequiredNullableModel.from_dict(
250-
d.pop("not_required_nullable_model", UNSET)
251-
)
248+
_not_required_nullable_model = d.pop("not_required_nullable_model", UNSET)
249+
if _not_required_nullable_model is not None and not isinstance(_not_required_nullable_model, Unset):
250+
not_required_nullable_model = AModelNotRequiredNullableModel.from_dict(_not_required_nullable_model)
252251

253252
def _parse_nullable_one_of_models(
254253
data: Union[None, Dict[str, Any]]
@@ -282,17 +281,19 @@ def _parse_not_required_one_of_models(
282281
if not isinstance(data, dict):
283282
raise TypeError()
284283
not_required_one_of_models = UNSET
285-
if data is not None and not isinstance(data, Unset):
286-
not_required_one_of_models = FreeFormModel.from_dict(data)
284+
_not_required_one_of_models = data
285+
if not isinstance(_not_required_one_of_models, Unset):
286+
not_required_one_of_models = FreeFormModel.from_dict(_not_required_one_of_models)
287287

288288
return not_required_one_of_models
289289
except: # noqa: E722
290290
pass
291291
if not isinstance(data, dict):
292292
raise TypeError()
293293
not_required_one_of_models = UNSET
294-
if data is not None and not isinstance(data, Unset):
295-
not_required_one_of_models = ModelWithUnionProperty.from_dict(data)
294+
_not_required_one_of_models = data
295+
if not isinstance(_not_required_one_of_models, Unset):
296+
not_required_one_of_models = ModelWithUnionProperty.from_dict(_not_required_one_of_models)
296297

297298
return not_required_one_of_models
298299

@@ -310,8 +311,9 @@ def _parse_not_required_nullable_one_of_models(
310311
if not isinstance(data, dict):
311312
raise TypeError()
312313
not_required_nullable_one_of_models = UNSET
313-
if data is not None and not isinstance(data, Unset):
314-
not_required_nullable_one_of_models = FreeFormModel.from_dict(data)
314+
_not_required_nullable_one_of_models = data
315+
if not isinstance(_not_required_nullable_one_of_models, Unset):
316+
not_required_nullable_one_of_models = FreeFormModel.from_dict(_not_required_nullable_one_of_models)
315317

316318
return not_required_nullable_one_of_models
317319
except: # noqa: E722
@@ -320,8 +322,11 @@ def _parse_not_required_nullable_one_of_models(
320322
if not isinstance(data, dict):
321323
raise TypeError()
322324
not_required_nullable_one_of_models = UNSET
323-
if data is not None and not isinstance(data, Unset):
324-
not_required_nullable_one_of_models = ModelWithUnionProperty.from_dict(data)
325+
_not_required_nullable_one_of_models = data
326+
if not isinstance(_not_required_nullable_one_of_models, Unset):
327+
not_required_nullable_one_of_models = ModelWithUnionProperty.from_dict(
328+
_not_required_nullable_one_of_models
329+
)
325330

326331
return not_required_nullable_one_of_models
327332
except: # noqa: E722

end_to_end_tests/golden-record-custom/custom_e2e/models/a_model_model.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def _parse_a_property(data: Union[Unset, int]) -> Union[Unset, AnEnum, AnIntEnum
4949
raise TypeError()
5050
a_property = UNSET
5151
_a_property = data
52-
if _a_property is not None and not isinstance(_a_property, Unset):
52+
if _a_property is not None:
5353
a_property = AnEnum(_a_property)
5454

5555
return a_property
@@ -59,7 +59,7 @@ def _parse_a_property(data: Union[Unset, int]) -> Union[Unset, AnEnum, AnIntEnum
5959
raise TypeError()
6060
a_property = UNSET
6161
_a_property = data
62-
if _a_property is not None and not isinstance(_a_property, Unset):
62+
if _a_property is not None:
6363
a_property = AnIntEnum(_a_property)
6464

6565
return a_property

end_to_end_tests/golden-record-custom/custom_e2e/models/a_model_not_required_model.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def _parse_a_property(data: Union[Unset, int]) -> Union[Unset, AnEnum, AnIntEnum
4949
raise TypeError()
5050
a_property = UNSET
5151
_a_property = data
52-
if _a_property is not None and not isinstance(_a_property, Unset):
52+
if _a_property is not None:
5353
a_property = AnEnum(_a_property)
5454

5555
return a_property
@@ -59,7 +59,7 @@ def _parse_a_property(data: Union[Unset, int]) -> Union[Unset, AnEnum, AnIntEnum
5959
raise TypeError()
6060
a_property = UNSET
6161
_a_property = data
62-
if _a_property is not None and not isinstance(_a_property, Unset):
62+
if _a_property is not None:
6363
a_property = AnIntEnum(_a_property)
6464

6565
return a_property

end_to_end_tests/golden-record-custom/custom_e2e/models/a_model_not_required_nullable_model.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def _parse_a_property(data: Union[Unset, int]) -> Union[Unset, AnEnum, AnIntEnum
4949
raise TypeError()
5050
a_property = UNSET
5151
_a_property = data
52-
if _a_property is not None and not isinstance(_a_property, Unset):
52+
if _a_property is not None:
5353
a_property = AnEnum(_a_property)
5454

5555
return a_property
@@ -59,7 +59,7 @@ def _parse_a_property(data: Union[Unset, int]) -> Union[Unset, AnEnum, AnIntEnum
5959
raise TypeError()
6060
a_property = UNSET
6161
_a_property = data
62-
if _a_property is not None and not isinstance(_a_property, Unset):
62+
if _a_property is not None:
6363
a_property = AnIntEnum(_a_property)
6464

6565
return a_property

end_to_end_tests/golden-record-custom/custom_e2e/models/a_model_nullable_model.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def _parse_a_property(data: Union[Unset, int]) -> Union[Unset, AnEnum, AnIntEnum
4949
raise TypeError()
5050
a_property = UNSET
5151
_a_property = data
52-
if _a_property is not None and not isinstance(_a_property, Unset):
52+
if _a_property is not None:
5353
a_property = AnEnum(_a_property)
5454

5555
return a_property
@@ -59,7 +59,7 @@ def _parse_a_property(data: Union[Unset, int]) -> Union[Unset, AnEnum, AnIntEnum
5959
raise TypeError()
6060
a_property = UNSET
6161
_a_property = data
62-
if _a_property is not None and not isinstance(_a_property, Unset):
62+
if _a_property is not None:
6363
a_property = AnIntEnum(_a_property)
6464

6565
return a_property

end_to_end_tests/golden-record-custom/custom_e2e/models/model_with_primitive_additional_properties.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,9 @@ def to_dict(self) -> Dict[str, Any]:
3232
def from_dict(src_dict: Dict[str, Any]) -> "ModelWithPrimitiveAdditionalProperties":
3333
d = src_dict.copy()
3434
a_date_holder: Union[Unset, ModelWithPrimitiveAdditionalPropertiesADateHolder] = UNSET
35-
if d.pop("a_date_holder", UNSET) is not None and not isinstance(d.pop("a_date_holder", UNSET), Unset):
36-
a_date_holder = ModelWithPrimitiveAdditionalPropertiesADateHolder.from_dict(d.pop("a_date_holder", UNSET))
35+
_a_date_holder = d.pop("a_date_holder", UNSET)
36+
if not isinstance(_a_date_holder, Unset):
37+
a_date_holder = ModelWithPrimitiveAdditionalPropertiesADateHolder.from_dict(_a_date_holder)
3738

3839
model_with_primitive_additional_properties = ModelWithPrimitiveAdditionalProperties(
3940
a_date_holder=a_date_holder,

end_to_end_tests/golden-record-custom/custom_e2e/models/model_with_union_property.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def _parse_a_property(data: Union[Unset, int]) -> Union[Unset, AnEnum, AnIntEnum
4747
raise TypeError()
4848
a_property = UNSET
4949
_a_property = data
50-
if _a_property is not None and not isinstance(_a_property, Unset):
50+
if _a_property is not None:
5151
a_property = AnEnum(_a_property)
5252

5353
return a_property
@@ -57,7 +57,7 @@ def _parse_a_property(data: Union[Unset, int]) -> Union[Unset, AnEnum, AnIntEnum
5757
raise TypeError()
5858
a_property = UNSET
5959
_a_property = data
60-
if _a_property is not None and not isinstance(_a_property, Unset):
60+
if _a_property is not None:
6161
a_property = AnIntEnum(_a_property)
6262

6363
return a_property

end_to_end_tests/golden-record/my_test_api_client/models/a_model.py

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ def _parse_one_of_models(data: Union[Dict[str, Any]]) -> Union[FreeFormModel, Mo
223223

224224
a_nullable_date = None
225225
_a_nullable_date = d.pop("a_nullable_date")
226-
if _a_nullable_date is not None and not isinstance(_a_nullable_date, Unset):
226+
if _a_nullable_date is not None:
227227
a_nullable_date = isoparse(cast(str, _a_nullable_date)).date()
228228

229229
attr_1_leading_digit = d.pop("1_leading_digit", UNSET)
@@ -235,20 +235,19 @@ def _parse_one_of_models(data: Union[Dict[str, Any]]) -> Union[FreeFormModel, Mo
235235
not_required_not_nullable = d.pop("not_required_not_nullable", UNSET)
236236

237237
nullable_model = None
238-
if d.pop("nullable_model") is not None and not isinstance(d.pop("nullable_model"), Unset):
239-
nullable_model = AModelNullableModel.from_dict(d.pop("nullable_model"))
238+
_nullable_model = d.pop("nullable_model")
239+
if _nullable_model is not None:
240+
nullable_model = AModelNullableModel.from_dict(_nullable_model)
240241

241242
not_required_model: Union[Unset, AModelNotRequiredModel] = UNSET
242-
if d.pop("not_required_model", UNSET) is not None and not isinstance(d.pop("not_required_model", UNSET), Unset):
243-
not_required_model = AModelNotRequiredModel.from_dict(d.pop("not_required_model", UNSET))
243+
_not_required_model = d.pop("not_required_model", UNSET)
244+
if not isinstance(_not_required_model, Unset):
245+
not_required_model = AModelNotRequiredModel.from_dict(_not_required_model)
244246

245247
not_required_nullable_model = None
246-
if d.pop("not_required_nullable_model", UNSET) is not None and not isinstance(
247-
d.pop("not_required_nullable_model", UNSET), Unset
248-
):
249-
not_required_nullable_model = AModelNotRequiredNullableModel.from_dict(
250-
d.pop("not_required_nullable_model", UNSET)
251-
)
248+
_not_required_nullable_model = d.pop("not_required_nullable_model", UNSET)
249+
if _not_required_nullable_model is not None and not isinstance(_not_required_nullable_model, Unset):
250+
not_required_nullable_model = AModelNotRequiredNullableModel.from_dict(_not_required_nullable_model)
252251

253252
def _parse_nullable_one_of_models(
254253
data: Union[None, Dict[str, Any]]
@@ -282,17 +281,19 @@ def _parse_not_required_one_of_models(
282281
if not isinstance(data, dict):
283282
raise TypeError()
284283
not_required_one_of_models = UNSET
285-
if data is not None and not isinstance(data, Unset):
286-
not_required_one_of_models = FreeFormModel.from_dict(data)
284+
_not_required_one_of_models = data
285+
if not isinstance(_not_required_one_of_models, Unset):
286+
not_required_one_of_models = FreeFormModel.from_dict(_not_required_one_of_models)
287287

288288
return not_required_one_of_models
289289
except: # noqa: E722
290290
pass
291291
if not isinstance(data, dict):
292292
raise TypeError()
293293
not_required_one_of_models = UNSET
294-
if data is not None and not isinstance(data, Unset):
295-
not_required_one_of_models = ModelWithUnionProperty.from_dict(data)
294+
_not_required_one_of_models = data
295+
if not isinstance(_not_required_one_of_models, Unset):
296+
not_required_one_of_models = ModelWithUnionProperty.from_dict(_not_required_one_of_models)
296297

297298
return not_required_one_of_models
298299

@@ -310,8 +311,9 @@ def _parse_not_required_nullable_one_of_models(
310311
if not isinstance(data, dict):
311312
raise TypeError()
312313
not_required_nullable_one_of_models = UNSET
313-
if data is not None and not isinstance(data, Unset):
314-
not_required_nullable_one_of_models = FreeFormModel.from_dict(data)
314+
_not_required_nullable_one_of_models = data
315+
if not isinstance(_not_required_nullable_one_of_models, Unset):
316+
not_required_nullable_one_of_models = FreeFormModel.from_dict(_not_required_nullable_one_of_models)
315317

316318
return not_required_nullable_one_of_models
317319
except: # noqa: E722
@@ -320,8 +322,11 @@ def _parse_not_required_nullable_one_of_models(
320322
if not isinstance(data, dict):
321323
raise TypeError()
322324
not_required_nullable_one_of_models = UNSET
323-
if data is not None and not isinstance(data, Unset):
324-
not_required_nullable_one_of_models = ModelWithUnionProperty.from_dict(data)
325+
_not_required_nullable_one_of_models = data
326+
if not isinstance(_not_required_nullable_one_of_models, Unset):
327+
not_required_nullable_one_of_models = ModelWithUnionProperty.from_dict(
328+
_not_required_nullable_one_of_models
329+
)
325330

326331
return not_required_nullable_one_of_models
327332
except: # noqa: E722

end_to_end_tests/golden-record/my_test_api_client/models/a_model_model.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def _parse_a_property(data: Union[Unset, int]) -> Union[Unset, AnEnum, AnIntEnum
4949
raise TypeError()
5050
a_property = UNSET
5151
_a_property = data
52-
if _a_property is not None and not isinstance(_a_property, Unset):
52+
if _a_property is not None:
5353
a_property = AnEnum(_a_property)
5454

5555
return a_property
@@ -59,7 +59,7 @@ def _parse_a_property(data: Union[Unset, int]) -> Union[Unset, AnEnum, AnIntEnum
5959
raise TypeError()
6060
a_property = UNSET
6161
_a_property = data
62-
if _a_property is not None and not isinstance(_a_property, Unset):
62+
if _a_property is not None:
6363
a_property = AnIntEnum(_a_property)
6464

6565
return a_property

end_to_end_tests/golden-record/my_test_api_client/models/a_model_not_required_model.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def _parse_a_property(data: Union[Unset, int]) -> Union[Unset, AnEnum, AnIntEnum
4949
raise TypeError()
5050
a_property = UNSET
5151
_a_property = data
52-
if _a_property is not None and not isinstance(_a_property, Unset):
52+
if _a_property is not None:
5353
a_property = AnEnum(_a_property)
5454

5555
return a_property
@@ -59,7 +59,7 @@ def _parse_a_property(data: Union[Unset, int]) -> Union[Unset, AnEnum, AnIntEnum
5959
raise TypeError()
6060
a_property = UNSET
6161
_a_property = data
62-
if _a_property is not None and not isinstance(_a_property, Unset):
62+
if _a_property is not None:
6363
a_property = AnIntEnum(_a_property)
6464

6565
return a_property

end_to_end_tests/golden-record/my_test_api_client/models/a_model_not_required_nullable_model.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def _parse_a_property(data: Union[Unset, int]) -> Union[Unset, AnEnum, AnIntEnum
4949
raise TypeError()
5050
a_property = UNSET
5151
_a_property = data
52-
if _a_property is not None and not isinstance(_a_property, Unset):
52+
if _a_property is not None:
5353
a_property = AnEnum(_a_property)
5454

5555
return a_property
@@ -59,7 +59,7 @@ def _parse_a_property(data: Union[Unset, int]) -> Union[Unset, AnEnum, AnIntEnum
5959
raise TypeError()
6060
a_property = UNSET
6161
_a_property = data
62-
if _a_property is not None and not isinstance(_a_property, Unset):
62+
if _a_property is not None:
6363
a_property = AnIntEnum(_a_property)
6464

6565
return a_property

end_to_end_tests/golden-record/my_test_api_client/models/a_model_nullable_model.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def _parse_a_property(data: Union[Unset, int]) -> Union[Unset, AnEnum, AnIntEnum
4949
raise TypeError()
5050
a_property = UNSET
5151
_a_property = data
52-
if _a_property is not None and not isinstance(_a_property, Unset):
52+
if _a_property is not None:
5353
a_property = AnEnum(_a_property)
5454

5555
return a_property
@@ -59,7 +59,7 @@ def _parse_a_property(data: Union[Unset, int]) -> Union[Unset, AnEnum, AnIntEnum
5959
raise TypeError()
6060
a_property = UNSET
6161
_a_property = data
62-
if _a_property is not None and not isinstance(_a_property, Unset):
62+
if _a_property is not None:
6363
a_property = AnIntEnum(_a_property)
6464

6565
return a_property

end_to_end_tests/golden-record/my_test_api_client/models/model_with_primitive_additional_properties.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,9 @@ def to_dict(self) -> Dict[str, Any]:
3232
def from_dict(src_dict: Dict[str, Any]) -> "ModelWithPrimitiveAdditionalProperties":
3333
d = src_dict.copy()
3434
a_date_holder: Union[Unset, ModelWithPrimitiveAdditionalPropertiesADateHolder] = UNSET
35-
if d.pop("a_date_holder", UNSET) is not None and not isinstance(d.pop("a_date_holder", UNSET), Unset):
36-
a_date_holder = ModelWithPrimitiveAdditionalPropertiesADateHolder.from_dict(d.pop("a_date_holder", UNSET))
35+
_a_date_holder = d.pop("a_date_holder", UNSET)
36+
if not isinstance(_a_date_holder, Unset):
37+
a_date_holder = ModelWithPrimitiveAdditionalPropertiesADateHolder.from_dict(_a_date_holder)
3738

3839
model_with_primitive_additional_properties = ModelWithPrimitiveAdditionalProperties(
3940
a_date_holder=a_date_holder,

end_to_end_tests/golden-record/my_test_api_client/models/model_with_union_property.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def _parse_a_property(data: Union[Unset, int]) -> Union[Unset, AnEnum, AnIntEnum
4747
raise TypeError()
4848
a_property = UNSET
4949
_a_property = data
50-
if _a_property is not None and not isinstance(_a_property, Unset):
50+
if _a_property is not None:
5151
a_property = AnEnum(_a_property)
5252

5353
return a_property
@@ -57,7 +57,7 @@ def _parse_a_property(data: Union[Unset, int]) -> Union[Unset, AnEnum, AnIntEnum
5757
raise TypeError()
5858
a_property = UNSET
5959
_a_property = data
60-
if _a_property is not None and not isinstance(_a_property, Unset):
60+
if _a_property is not None:
6161
a_property = AnIntEnum(_a_property)
6262

6363
return a_property

0 commit comments

Comments
 (0)