Skip to content

Commit 306b63c

Browse files
chore(types): change optional parameter type from NotGiven to Omit
1 parent 2804bd6 commit 306b63c

File tree

2 files changed

+35
-34
lines changed

2 files changed

+35
-34
lines changed

src/replicate/_client.py

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
from ._qs import Querystring
3030
from .types import client_search_params
3131
from ._types import (
32-
NOT_GIVEN,
3332
Body,
3433
Omit,
3534
Query,
@@ -39,6 +38,8 @@
3938
Transport,
4039
ProxiesTypes,
4140
RequestOptions,
41+
omit,
42+
not_given,
4243
)
4344
from ._utils import (
4445
is_given,
@@ -103,7 +104,7 @@ def __init__(
103104
*,
104105
bearer_token: str | None = None,
105106
base_url: str | httpx.URL | None = None,
106-
timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN,
107+
timeout: float | Timeout | None | NotGiven = not_given,
107108
max_retries: int = DEFAULT_MAX_RETRIES,
108109
default_headers: Mapping[str, str] | None = None,
109110
default_query: Mapping[str, object] | None = None,
@@ -241,7 +242,7 @@ def run(
241242
*,
242243
file_encoding_strategy: Optional["FileEncodingStrategy"] = None,
243244
use_file_output: bool = True,
244-
wait: Union[int, bool, NotGiven] = NOT_GIVEN,
245+
wait: Union[int, bool, NotGiven] = not_given,
245246
**params: Unpack[PredictionCreateParamsWithoutVersion],
246247
) -> Any:
247248
"""
@@ -325,9 +326,9 @@ def copy(
325326
*,
326327
bearer_token: str | None = None,
327328
base_url: str | httpx.URL | None = None,
328-
timeout: float | Timeout | None | NotGiven = NOT_GIVEN,
329+
timeout: float | Timeout | None | NotGiven = not_given,
329330
http_client: httpx.Client | None = None,
330-
max_retries: int | NotGiven = NOT_GIVEN,
331+
max_retries: int | NotGiven = not_given,
331332
default_headers: Mapping[str, str] | None = None,
332333
set_default_headers: Mapping[str, str] | None = None,
333334
default_query: Mapping[str, object] | None = None,
@@ -375,13 +376,13 @@ def search(
375376
self,
376377
*,
377378
query: str,
378-
limit: int | NotGiven = NOT_GIVEN,
379+
limit: int | Omit = omit,
379380
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
380381
# The extra values given here take precedence over values defined on the client or passed to this method.
381382
extra_headers: Headers | None = None,
382383
extra_query: Query | None = None,
383384
extra_body: Body | None = None,
384-
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
385+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
385386
) -> SearchResponse:
386387
"""
387388
Search for public models, collections, and docs using a text query.
@@ -478,7 +479,7 @@ def __init__(
478479
*,
479480
bearer_token: str | None = None,
480481
base_url: str | httpx.URL | None = None,
481-
timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN,
482+
timeout: float | Timeout | None | NotGiven = not_given,
482483
max_retries: int = DEFAULT_MAX_RETRIES,
483484
default_headers: Mapping[str, str] | None = None,
484485
default_query: Mapping[str, object] | None = None,
@@ -616,7 +617,7 @@ async def run(
616617
*,
617618
use_file_output: bool = True,
618619
file_encoding_strategy: Optional["FileEncodingStrategy"] = None,
619-
wait: Union[int, bool, NotGiven] = NOT_GIVEN,
620+
wait: Union[int, bool, NotGiven] = not_given,
620621
**params: Unpack[PredictionCreateParamsWithoutVersion],
621622
) -> Any:
622623
"""
@@ -700,9 +701,9 @@ def copy(
700701
*,
701702
bearer_token: str | None = None,
702703
base_url: str | httpx.URL | None = None,
703-
timeout: float | Timeout | None | NotGiven = NOT_GIVEN,
704+
timeout: float | Timeout | None | NotGiven = not_given,
704705
http_client: httpx.AsyncClient | None = None,
705-
max_retries: int | NotGiven = NOT_GIVEN,
706+
max_retries: int | NotGiven = not_given,
706707
default_headers: Mapping[str, str] | None = None,
707708
set_default_headers: Mapping[str, str] | None = None,
708709
default_query: Mapping[str, object] | None = None,
@@ -750,13 +751,13 @@ async def search(
750751
self,
751752
*,
752753
query: str,
753-
limit: int | NotGiven = NOT_GIVEN,
754+
limit: int | Omit = omit,
754755
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
755756
# The extra values given here take precedence over values defined on the client or passed to this method.
756757
extra_headers: Headers | None = None,
757758
extra_query: Query | None = None,
758759
extra_body: Body | None = None,
759-
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
760+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
760761
) -> SearchResponse:
761762
"""
762763
Search for public models, collections, and docs using a text query.

src/replicate/resources/predictions.py

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from replicate.lib._files import FileEncodingStrategy, encode_json, async_encode_json
1212

1313
from ..types import prediction_list_params, prediction_create_params
14-
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
14+
from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
1515
from .._utils import maybe_transform, strip_not_given, async_maybe_transform
1616
from .._compat import cached_property
1717
from .._resource import SyncAPIResource, AsyncAPIResource
@@ -63,17 +63,17 @@ def create(
6363
*,
6464
input: object,
6565
version: str,
66-
stream: bool | NotGiven = NOT_GIVEN,
67-
webhook: str | NotGiven = NOT_GIVEN,
68-
webhook_events_filter: List[Literal["start", "output", "logs", "completed"]] | NotGiven = NOT_GIVEN,
69-
prefer: str | NotGiven = NOT_GIVEN,
66+
stream: bool | Omit = omit,
67+
webhook: str | Omit = omit,
68+
webhook_events_filter: List[Literal["start", "output", "logs", "completed"]] | Omit = omit,
69+
prefer: str | Omit = omit,
7070
file_encoding_strategy: Optional["FileEncodingStrategy"] = None,
7171
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
7272
# The extra values given here take precedence over values defined on the client or passed to this method.
7373
extra_headers: Headers | None = None,
7474
extra_query: Query | None = None,
7575
extra_body: Body | None = None,
76-
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
76+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
7777
) -> Prediction:
7878
"""
7979
Create a prediction for the model version and inputs you provide.
@@ -208,14 +208,14 @@ def create(
208208
def list(
209209
self,
210210
*,
211-
created_after: Union[str, datetime] | NotGiven = NOT_GIVEN,
212-
created_before: Union[str, datetime] | NotGiven = NOT_GIVEN,
211+
created_after: Union[str, datetime] | Omit = omit,
212+
created_before: Union[str, datetime] | Omit = omit,
213213
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
214214
# The extra values given here take precedence over values defined on the client or passed to this method.
215215
extra_headers: Headers | None = None,
216216
extra_query: Query | None = None,
217217
extra_body: Body | None = None,
218-
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
218+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
219219
) -> SyncCursorURLPageWithCreatedFilters[Prediction]:
220220
"""
221221
Get a paginated list of all predictions created by the user or organization
@@ -330,7 +330,7 @@ def cancel(
330330
extra_headers: Headers | None = None,
331331
extra_query: Query | None = None,
332332
extra_body: Body | None = None,
333-
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
333+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
334334
) -> Prediction:
335335
"""
336336
Cancel a prediction that is currently running.
@@ -386,7 +386,7 @@ def get(
386386
extra_headers: Headers | None = None,
387387
extra_query: Query | None = None,
388388
extra_body: Body | None = None,
389-
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
389+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
390390
) -> Prediction:
391391
"""
392392
Get the current state of a prediction.
@@ -514,17 +514,17 @@ async def create(
514514
*,
515515
input: object,
516516
version: str,
517-
stream: bool | NotGiven = NOT_GIVEN,
518-
webhook: str | NotGiven = NOT_GIVEN,
519-
webhook_events_filter: List[Literal["start", "output", "logs", "completed"]] | NotGiven = NOT_GIVEN,
520-
prefer: str | NotGiven = NOT_GIVEN,
517+
stream: bool | Omit = omit,
518+
webhook: str | Omit = omit,
519+
webhook_events_filter: List[Literal["start", "output", "logs", "completed"]] | Omit = omit,
520+
prefer: str | Omit = omit,
521521
file_encoding_strategy: Optional["FileEncodingStrategy"] = None,
522522
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
523523
# The extra values given here take precedence over values defined on the client or passed to this method.
524524
extra_headers: Headers | None = None,
525525
extra_query: Query | None = None,
526526
extra_body: Body | None = None,
527-
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
527+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
528528
) -> Prediction:
529529
"""
530530
Create a prediction for the model version and inputs you provide.
@@ -661,14 +661,14 @@ async def create(
661661
def list(
662662
self,
663663
*,
664-
created_after: Union[str, datetime] | NotGiven = NOT_GIVEN,
665-
created_before: Union[str, datetime] | NotGiven = NOT_GIVEN,
664+
created_after: Union[str, datetime] | Omit = omit,
665+
created_before: Union[str, datetime] | Omit = omit,
666666
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
667667
# The extra values given here take precedence over values defined on the client or passed to this method.
668668
extra_headers: Headers | None = None,
669669
extra_query: Query | None = None,
670670
extra_body: Body | None = None,
671-
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
671+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
672672
) -> AsyncPaginator[Prediction, AsyncCursorURLPageWithCreatedFilters[Prediction]]:
673673
"""
674674
Get a paginated list of all predictions created by the user or organization
@@ -783,7 +783,7 @@ async def cancel(
783783
extra_headers: Headers | None = None,
784784
extra_query: Query | None = None,
785785
extra_body: Body | None = None,
786-
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
786+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
787787
) -> Prediction:
788788
"""
789789
Cancel a prediction that is currently running.
@@ -839,7 +839,7 @@ async def get(
839839
extra_headers: Headers | None = None,
840840
extra_query: Query | None = None,
841841
extra_body: Body | None = None,
842-
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
842+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
843843
) -> Prediction:
844844
"""
845845
Get the current state of a prediction.

0 commit comments

Comments
 (0)