Skip to content

Commit 67e848d

Browse files
stainless-app[bot]stainless-bot
authored andcommitted
feat(api): update via SDK Studio (#251)
1 parent 6e3ce75 commit 67e848d

File tree

3 files changed

+25
-7
lines changed

3 files changed

+25
-7
lines changed

requirements-dev.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ markdown-it-py==3.0.0
4949
# via rich
5050
mdurl==0.1.2
5151
# via markdown-it-py
52-
mypy==1.7.1
52+
mypy==1.10.1
5353
mypy-extensions==1.0.0
5454
# via mypy
5555
nodeenv==1.8.0

src/python_minus_intercom/_base_client.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -955,6 +955,11 @@ def _request(
955955
stream: bool,
956956
stream_cls: type[_StreamT] | None,
957957
) -> ResponseT | _StreamT:
958+
# create a copy of the options we were given so that if the
959+
# options are mutated later & we then retry, the retries are
960+
# given the original options
961+
input_options = model_copy(options)
962+
958963
cast_to = self._maybe_override_cast_to(cast_to, options)
959964
self._prepare_options(options)
960965

@@ -979,7 +984,7 @@ def _request(
979984

980985
if retries > 0:
981986
return self._retry_request(
982-
options,
987+
input_options,
983988
cast_to,
984989
retries,
985990
stream=stream,
@@ -994,7 +999,7 @@ def _request(
994999

9951000
if retries > 0:
9961001
return self._retry_request(
997-
options,
1002+
input_options,
9981003
cast_to,
9991004
retries,
10001005
stream=stream,
@@ -1022,7 +1027,7 @@ def _request(
10221027
if retries > 0 and self._should_retry(err.response):
10231028
err.response.close()
10241029
return self._retry_request(
1025-
options,
1030+
input_options,
10261031
cast_to,
10271032
retries,
10281033
err.response.headers,
@@ -1518,6 +1523,11 @@ async def _request(
15181523
# execute it earlier while we are in an async context
15191524
self._platform = await asyncify(get_platform)()
15201525

1526+
# create a copy of the options we were given so that if the
1527+
# options are mutated later & we then retry, the retries are
1528+
# given the original options
1529+
input_options = model_copy(options)
1530+
15211531
cast_to = self._maybe_override_cast_to(cast_to, options)
15221532
await self._prepare_options(options)
15231533

@@ -1540,7 +1550,7 @@ async def _request(
15401550

15411551
if retries > 0:
15421552
return await self._retry_request(
1543-
options,
1553+
input_options,
15441554
cast_to,
15451555
retries,
15461556
stream=stream,
@@ -1555,7 +1565,7 @@ async def _request(
15551565

15561566
if retries > 0:
15571567
return await self._retry_request(
1558-
options,
1568+
input_options,
15591569
cast_to,
15601570
retries,
15611571
stream=stream,
@@ -1578,7 +1588,7 @@ async def _request(
15781588
if retries > 0 and self._should_retry(err.response):
15791589
await err.response.aclose()
15801590
return await self._retry_request(
1581-
options,
1591+
input_options,
15821592
cast_to,
15831593
retries,
15841594
err.response.headers,

src/python_minus_intercom/_models.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -643,6 +643,14 @@ def validate_type(*, type_: type[_T], value: object) -> _T:
643643
return cast(_T, _validate_non_model_type(type_=type_, value=value))
644644

645645

646+
def set_pydantic_config(typ: Any, config: pydantic.ConfigDict) -> None:
647+
"""Add a pydantic config for the given type.
648+
649+
Note: this is a no-op on Pydantic v1.
650+
"""
651+
setattr(typ, "__pydantic_config__", config) # noqa: B010
652+
653+
646654
# our use of subclasssing here causes weirdness for type checkers,
647655
# so we just pretend that we don't subclass
648656
if TYPE_CHECKING:

0 commit comments

Comments
 (0)