Skip to content

Commit 7847cd0

Browse files
Merge branch 'main' into fix/url-encoding
2 parents 612504a + 72e4efe commit 7847cd0

File tree

25 files changed

+201
-167
lines changed

25 files changed

+201
-167
lines changed

end_to_end_tests/docstrings-on-attributes-golden-record/my_test_api_client/client.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def with_cookies(self, cookies: dict[str, str]) -> "Client":
5858
return evolve(self, cookies={**self._cookies, **cookies})
5959

6060
def with_timeout(self, timeout: httpx.Timeout) -> "Client":
61-
"""Get a new client matching this one with a new timeout (in seconds)"""
61+
"""Get a new client matching this one with a new timeout configuration"""
6262
if self._client is not None:
6363
self._client.timeout = timeout
6464
if self._async_client is not None:
@@ -97,7 +97,7 @@ def __exit__(self, *args: Any, **kwargs: Any) -> None:
9797
self.get_httpx_client().__exit__(*args, **kwargs)
9898

9999
def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> "Client":
100-
"""Manually the underlying httpx.AsyncClient
100+
"""Manually set the underlying httpx.AsyncClient
101101
102102
**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
103103
"""
@@ -188,7 +188,7 @@ def with_cookies(self, cookies: dict[str, str]) -> "AuthenticatedClient":
188188
return evolve(self, cookies={**self._cookies, **cookies})
189189

190190
def with_timeout(self, timeout: httpx.Timeout) -> "AuthenticatedClient":
191-
"""Get a new client matching this one with a new timeout (in seconds)"""
191+
"""Get a new client matching this one with a new timeout configuration"""
192192
if self._client is not None:
193193
self._client.timeout = timeout
194194
if self._async_client is not None:
@@ -228,7 +228,7 @@ def __exit__(self, *args: Any, **kwargs: Any) -> None:
228228
self.get_httpx_client().__exit__(*args, **kwargs)
229229

230230
def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> "AuthenticatedClient":
231-
"""Manually the underlying httpx.AsyncClient
231+
"""Manually set the underlying httpx.AsyncClient
232232
233233
**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
234234
"""

end_to_end_tests/golden-record/my_test_api_client/api/default/get_models_oneof_with_required_const.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def _parse_response_200(
3737
response_200_type_0 = GetModelsOneofWithRequiredConstResponse200Type0.from_dict(data)
3838

3939
return response_200_type_0
40-
except: # noqa: E722
40+
except (TypeError, ValueError, AttributeError, KeyError):
4141
pass
4242
if not isinstance(data, dict):
4343
raise TypeError()

end_to_end_tests/golden-record/my_test_api_client/client.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def with_cookies(self, cookies: dict[str, str]) -> "Client":
6262
return evolve(self, cookies={**self._cookies, **cookies})
6363

6464
def with_timeout(self, timeout: httpx.Timeout) -> "Client":
65-
"""Get a new client matching this one with a new timeout (in seconds)"""
65+
"""Get a new client matching this one with a new timeout configuration"""
6666
if self._client is not None:
6767
self._client.timeout = timeout
6868
if self._async_client is not None:
@@ -101,7 +101,7 @@ def __exit__(self, *args: Any, **kwargs: Any) -> None:
101101
self.get_httpx_client().__exit__(*args, **kwargs)
102102

103103
def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> "Client":
104-
"""Manually the underlying httpx.AsyncClient
104+
"""Manually set the underlying httpx.AsyncClient
105105
106106
**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
107107
"""
@@ -196,7 +196,7 @@ def with_cookies(self, cookies: dict[str, str]) -> "AuthenticatedClient":
196196
return evolve(self, cookies={**self._cookies, **cookies})
197197

198198
def with_timeout(self, timeout: httpx.Timeout) -> "AuthenticatedClient":
199-
"""Get a new client matching this one with a new timeout (in seconds)"""
199+
"""Get a new client matching this one with a new timeout configuration"""
200200
if self._client is not None:
201201
self._client.timeout = timeout
202202
if self._async_client is not None:
@@ -236,7 +236,7 @@ def __exit__(self, *args: Any, **kwargs: Any) -> None:
236236
self.get_httpx_client().__exit__(*args, **kwargs)
237237

238238
def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> "AuthenticatedClient":
239-
"""Manually the underlying httpx.AsyncClient
239+
"""Manually set the underlying httpx.AsyncClient
240240
241241
**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
242242
"""

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

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ def _parse_a_camel_date_time(data: object) -> datetime.date | datetime.datetime:
272272
a_camel_date_time_type_0 = isoparse(data)
273273

274274
return a_camel_date_time_type_0
275-
except: # noqa: E722
275+
except (TypeError, ValueError, AttributeError, KeyError):
276276
pass
277277
if not isinstance(data, str):
278278
raise TypeError()
@@ -293,7 +293,7 @@ def _parse_a_nullable_date(data: object) -> datetime.date | None:
293293
a_nullable_date_type_0 = isoparse(data).date()
294294

295295
return a_nullable_date_type_0
296-
except: # noqa: E722
296+
except (TypeError, ValueError, AttributeError, KeyError):
297297
pass
298298
return cast(datetime.date | None, data)
299299

@@ -310,7 +310,7 @@ def _parse_a_nullable_uuid(data: object) -> None | UUID:
310310
a_nullable_uuid_type_0 = UUID(data)
311311

312312
return a_nullable_uuid_type_0
313-
except: # noqa: E722
313+
except (TypeError, ValueError, AttributeError, KeyError):
314314
pass
315315
return cast(None | UUID, data)
316316

@@ -332,15 +332,15 @@ def _parse_one_of_models(data: object) -> Any | FreeFormModel | ModelWithUnionPr
332332
one_of_models_type_0 = FreeFormModel.from_dict(data)
333333

334334
return one_of_models_type_0
335-
except: # noqa: E722
335+
except (TypeError, ValueError, AttributeError, KeyError):
336336
pass
337337
try:
338338
if not isinstance(data, dict):
339339
raise TypeError()
340340
one_of_models_type_1 = ModelWithUnionProperty.from_dict(data)
341341

342342
return one_of_models_type_1
343-
except: # noqa: E722
343+
except (TypeError, ValueError, AttributeError, KeyError):
344344
pass
345345
return cast(Any | FreeFormModel | ModelWithUnionProperty, data)
346346

@@ -355,15 +355,15 @@ def _parse_nullable_one_of_models(data: object) -> FreeFormModel | ModelWithUnio
355355
nullable_one_of_models_type_0 = FreeFormModel.from_dict(data)
356356

357357
return nullable_one_of_models_type_0
358-
except: # noqa: E722
358+
except (TypeError, ValueError, AttributeError, KeyError):
359359
pass
360360
try:
361361
if not isinstance(data, dict):
362362
raise TypeError()
363363
nullable_one_of_models_type_1 = ModelWithUnionProperty.from_dict(data)
364364

365365
return nullable_one_of_models_type_1
366-
except: # noqa: E722
366+
except (TypeError, ValueError, AttributeError, KeyError):
367367
pass
368368
return cast(FreeFormModel | ModelWithUnionProperty | None, data)
369369

@@ -380,7 +380,7 @@ def _parse_nullable_model(data: object) -> ModelWithUnionProperty | None:
380380
nullable_model_type_1 = ModelWithUnionProperty.from_dict(data)
381381

382382
return nullable_model_type_1
383-
except: # noqa: E722
383+
except (TypeError, ValueError, AttributeError, KeyError):
384384
pass
385385
return cast(ModelWithUnionProperty | None, data)
386386

@@ -395,17 +395,19 @@ def _parse_nullable_model(data: object) -> ModelWithUnionProperty | None:
395395
else:
396396
an_optional_allof_enum = AnAllOfEnum(_an_optional_allof_enum)
397397

398-
nested_list_of_enums = []
399398
_nested_list_of_enums = d.pop("nested_list_of_enums", UNSET)
400-
for nested_list_of_enums_item_data in _nested_list_of_enums or []:
401-
nested_list_of_enums_item = []
402-
_nested_list_of_enums_item = nested_list_of_enums_item_data
403-
for nested_list_of_enums_item_item_data in _nested_list_of_enums_item:
404-
nested_list_of_enums_item_item = DifferentEnum(nested_list_of_enums_item_item_data)
399+
nested_list_of_enums: list[list[DifferentEnum]] | Unset = UNSET
400+
if _nested_list_of_enums is not UNSET:
401+
nested_list_of_enums = []
402+
for nested_list_of_enums_item_data in _nested_list_of_enums:
403+
nested_list_of_enums_item = []
404+
_nested_list_of_enums_item = nested_list_of_enums_item_data
405+
for nested_list_of_enums_item_item_data in _nested_list_of_enums_item:
406+
nested_list_of_enums_item_item = DifferentEnum(nested_list_of_enums_item_item_data)
405407

406-
nested_list_of_enums_item.append(nested_list_of_enums_item_item)
408+
nested_list_of_enums_item.append(nested_list_of_enums_item_item)
407409

408-
nested_list_of_enums.append(nested_list_of_enums_item)
410+
nested_list_of_enums.append(nested_list_of_enums_item)
409411

410412
_a_not_required_date = d.pop("a_not_required_date", UNSET)
411413
a_not_required_date: datetime.date | Unset
@@ -445,7 +447,7 @@ def _parse_not_required_one_of_models(data: object) -> FreeFormModel | ModelWith
445447
not_required_one_of_models_type_0 = FreeFormModel.from_dict(data)
446448

447449
return not_required_one_of_models_type_0
448-
except: # noqa: E722
450+
except (TypeError, ValueError, AttributeError, KeyError):
449451
pass
450452
if not isinstance(data, dict):
451453
raise TypeError()
@@ -468,15 +470,15 @@ def _parse_not_required_nullable_one_of_models(
468470
not_required_nullable_one_of_models_type_0 = FreeFormModel.from_dict(data)
469471

470472
return not_required_nullable_one_of_models_type_0
471-
except: # noqa: E722
473+
except (TypeError, ValueError, AttributeError, KeyError):
472474
pass
473475
try:
474476
if not isinstance(data, dict):
475477
raise TypeError()
476478
not_required_nullable_one_of_models_type_1 = ModelWithUnionProperty.from_dict(data)
477479

478480
return not_required_nullable_one_of_models_type_1
479-
except: # noqa: E722
481+
except (TypeError, ValueError, AttributeError, KeyError):
480482
pass
481483
return cast(FreeFormModel | ModelWithUnionProperty | None | str | Unset, data)
482484

@@ -502,7 +504,7 @@ def _parse_not_required_nullable_model(data: object) -> ModelWithUnionProperty |
502504
not_required_nullable_model_type_1 = ModelWithUnionProperty.from_dict(data)
503505

504506
return not_required_nullable_model_type_1
505-
except: # noqa: E722
507+
except (TypeError, ValueError, AttributeError, KeyError):
506508
pass
507509
return cast(ModelWithUnionProperty | None | Unset, data)
508510

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

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,18 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
5050
)
5151

5252
d = dict(src_dict)
53-
circular = []
5453
_circular = d.pop("circular", UNSET)
55-
for componentsschemas_an_array_with_a_circular_ref_in_items_object_b_item_data in _circular or []:
56-
componentsschemas_an_array_with_a_circular_ref_in_items_object_b_item = (
57-
AnArrayWithACircularRefInItemsObjectBItem.from_dict(
58-
componentsschemas_an_array_with_a_circular_ref_in_items_object_b_item_data
54+
circular: list[AnArrayWithACircularRefInItemsObjectBItem] | Unset = UNSET
55+
if _circular is not UNSET:
56+
circular = []
57+
for componentsschemas_an_array_with_a_circular_ref_in_items_object_b_item_data in _circular:
58+
componentsschemas_an_array_with_a_circular_ref_in_items_object_b_item = (
59+
AnArrayWithACircularRefInItemsObjectBItem.from_dict(
60+
componentsschemas_an_array_with_a_circular_ref_in_items_object_b_item_data
61+
)
5962
)
60-
)
6163

62-
circular.append(componentsschemas_an_array_with_a_circular_ref_in_items_object_b_item)
64+
circular.append(componentsschemas_an_array_with_a_circular_ref_in_items_object_b_item)
6365

6466
an_array_with_a_circular_ref_in_items_object_a_item = cls(
6567
circular=circular,

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

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,18 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
5050
)
5151

5252
d = dict(src_dict)
53-
circular = []
5453
_circular = d.pop("circular", UNSET)
55-
for componentsschemas_an_array_with_a_circular_ref_in_items_object_a_item_data in _circular or []:
56-
componentsschemas_an_array_with_a_circular_ref_in_items_object_a_item = (
57-
AnArrayWithACircularRefInItemsObjectAItem.from_dict(
58-
componentsschemas_an_array_with_a_circular_ref_in_items_object_a_item_data
54+
circular: list[AnArrayWithACircularRefInItemsObjectAItem] | Unset = UNSET
55+
if _circular is not UNSET:
56+
circular = []
57+
for componentsschemas_an_array_with_a_circular_ref_in_items_object_a_item_data in _circular:
58+
componentsschemas_an_array_with_a_circular_ref_in_items_object_a_item = (
59+
AnArrayWithACircularRefInItemsObjectAItem.from_dict(
60+
componentsschemas_an_array_with_a_circular_ref_in_items_object_a_item_data
61+
)
5962
)
60-
)
6163

62-
circular.append(componentsschemas_an_array_with_a_circular_ref_in_items_object_a_item)
64+
circular.append(componentsschemas_an_array_with_a_circular_ref_in_items_object_a_item)
6365

6466
an_array_with_a_circular_ref_in_items_object_b_item = cls(
6567
circular=circular,

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

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,18 @@ def to_dict(self) -> dict[str, Any]:
4242
@classmethod
4343
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
4444
d = dict(src_dict)
45-
recursive = []
4645
_recursive = d.pop("recursive", UNSET)
47-
for componentsschemas_an_array_with_a_recursive_ref_in_items_object_item_data in _recursive or []:
48-
componentsschemas_an_array_with_a_recursive_ref_in_items_object_item = (
49-
AnArrayWithARecursiveRefInItemsObjectItem.from_dict(
50-
componentsschemas_an_array_with_a_recursive_ref_in_items_object_item_data
46+
recursive: list[AnArrayWithARecursiveRefInItemsObjectItem] | Unset = UNSET
47+
if _recursive is not UNSET:
48+
recursive = []
49+
for componentsschemas_an_array_with_a_recursive_ref_in_items_object_item_data in _recursive:
50+
componentsschemas_an_array_with_a_recursive_ref_in_items_object_item = (
51+
AnArrayWithARecursiveRefInItemsObjectItem.from_dict(
52+
componentsschemas_an_array_with_a_recursive_ref_in_items_object_item_data
53+
)
5154
)
52-
)
5355

54-
recursive.append(componentsschemas_an_array_with_a_recursive_ref_in_items_object_item)
56+
recursive.append(componentsschemas_an_array_with_a_recursive_ref_in_items_object_item)
5557

5658
an_array_with_a_recursive_ref_in_items_object_item = cls(
5759
recursive=recursive,

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

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ def _parse_some_nullable_object(data: object) -> BodyUploadFileTestsUploadPostSo
276276
some_nullable_object_type_0 = BodyUploadFileTestsUploadPostSomeNullableObject.from_dict(data)
277277

278278
return some_nullable_object_type_0
279-
except: # noqa: E722
279+
except (TypeError, ValueError, AttributeError, KeyError):
280280
pass
281281
return cast(BodyUploadFileTestsUploadPostSomeNullableObject | None, data)
282282

@@ -316,18 +316,20 @@ def _parse_some_nullable_number(data: object) -> float | None | Unset:
316316

317317
some_nullable_number = _parse_some_nullable_number(d.pop("some_nullable_number", UNSET))
318318

319-
some_int_array = []
320319
_some_int_array = d.pop("some_int_array", UNSET)
321-
for some_int_array_item_data in _some_int_array or []:
320+
some_int_array: list[int | None] | Unset = UNSET
321+
if _some_int_array is not UNSET:
322+
some_int_array = []
323+
for some_int_array_item_data in _some_int_array:
322324

323-
def _parse_some_int_array_item(data: object) -> int | None:
324-
if data is None:
325-
return data
326-
return cast(int | None, data)
325+
def _parse_some_int_array_item(data: object) -> int | None:
326+
if data is None:
327+
return data
328+
return cast(int | None, data)
327329

328-
some_int_array_item = _parse_some_int_array_item(some_int_array_item_data)
330+
some_int_array_item = _parse_some_int_array_item(some_int_array_item_data)
329331

330-
some_int_array.append(some_int_array_item)
332+
some_int_array.append(some_int_array_item)
331333

332334
def _parse_some_array(data: object) -> list[AFormData] | None | Unset:
333335
if data is None:
@@ -345,7 +347,7 @@ def _parse_some_array(data: object) -> list[AFormData] | None | Unset:
345347
some_array_type_0.append(some_array_type_0_item)
346348

347349
return some_array_type_0
348-
except: # noqa: E722
350+
except (TypeError, ValueError, AttributeError, KeyError):
349351
pass
350352
return cast(list[AFormData] | None | Unset, data)
351353

0 commit comments

Comments
 (0)