|
4 | 4 |
|
5 | 5 | import os |
6 | 6 | import asyncio |
7 | | -from typing import Union, Mapping |
8 | | -from typing_extensions import override |
| 7 | +from typing import Any, Union, Mapping |
| 8 | +from typing_extensions import Self, override |
9 | 9 |
|
10 | 10 | import httpx |
11 | 11 |
|
@@ -145,12 +145,10 @@ def copy( |
145 | 145 | set_default_headers: Mapping[str, str] | None = None, |
146 | 146 | default_query: Mapping[str, object] | None = None, |
147 | 147 | set_default_query: Mapping[str, object] | None = None, |
148 | | - ) -> Orb: |
| 148 | + _extra_kwargs: Mapping[str, Any] = {}, |
| 149 | + ) -> Self: |
149 | 150 | """ |
150 | 151 | Create a new client instance re-using the same options given to the current client with optional overriding. |
151 | | -
|
152 | | - It should be noted that this does not share the underlying httpx client class which may lead |
153 | | - to performance issues. |
154 | 152 | """ |
155 | 153 | if default_headers is not None and set_default_headers is not None: |
156 | 154 | raise ValueError("The `default_headers` and `set_default_headers` arguments are mutually exclusive") |
@@ -179,6 +177,7 @@ def copy( |
179 | 177 | max_retries=max_retries if is_given(max_retries) else self.max_retries, |
180 | 178 | default_headers=headers, |
181 | 179 | default_query=params, |
| 180 | + **_extra_kwargs, |
182 | 181 | ) |
183 | 182 |
|
184 | 183 | # Alias for `copy` for nicer inline usage, e.g. |
@@ -383,12 +382,10 @@ def copy( |
383 | 382 | set_default_headers: Mapping[str, str] | None = None, |
384 | 383 | default_query: Mapping[str, object] | None = None, |
385 | 384 | set_default_query: Mapping[str, object] | None = None, |
386 | | - ) -> AsyncOrb: |
| 385 | + _extra_kwargs: Mapping[str, Any] = {}, |
| 386 | + ) -> Self: |
387 | 387 | """ |
388 | 388 | Create a new client instance re-using the same options given to the current client with optional overriding. |
389 | | -
|
390 | | - It should be noted that this does not share the underlying httpx client class which may lead |
391 | | - to performance issues. |
392 | 389 | """ |
393 | 390 | if default_headers is not None and set_default_headers is not None: |
394 | 391 | raise ValueError("The `default_headers` and `set_default_headers` arguments are mutually exclusive") |
@@ -417,6 +414,7 @@ def copy( |
417 | 414 | max_retries=max_retries if is_given(max_retries) else self.max_retries, |
418 | 415 | default_headers=headers, |
419 | 416 | default_query=params, |
| 417 | + **_extra_kwargs, |
420 | 418 | ) |
421 | 419 |
|
422 | 420 | # Alias for `copy` for nicer inline usage, e.g. |
|
0 commit comments