Skip to content

Commit be4a6d6

Browse files
feat(types): replace List[str] with SequenceNotStr in params
1 parent 24f5841 commit be4a6d6

25 files changed

+134
-97
lines changed

src/asktable/_utils/_transform.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
lru_cache,
1717
is_mapping,
1818
is_iterable,
19+
is_sequence,
1920
)
2021
from .._files import is_base64_file_input
2122
from ._typing import (
@@ -24,6 +25,7 @@
2425
extract_type_arg,
2526
is_iterable_type,
2627
is_required_type,
28+
is_sequence_type,
2729
is_annotated_type,
2830
strip_annotated_type,
2931
)
@@ -184,6 +186,8 @@ def _transform_recursive(
184186
(is_list_type(stripped_type) and is_list(data))
185187
# Iterable[T]
186188
or (is_iterable_type(stripped_type) and is_iterable(data) and not isinstance(data, str))
189+
# Sequence[T]
190+
or (is_sequence_type(stripped_type) and is_sequence(data) and not isinstance(data, str))
187191
):
188192
# dicts are technically iterable, but it is an iterable on the keys of the dict and is not usually
189193
# intended as an iterable, so we don't transform it.
@@ -346,6 +350,8 @@ async def _async_transform_recursive(
346350
(is_list_type(stripped_type) and is_list(data))
347351
# Iterable[T]
348352
or (is_iterable_type(stripped_type) and is_iterable(data) and not isinstance(data, str))
353+
# Sequence[T]
354+
or (is_sequence_type(stripped_type) and is_sequence(data) and not isinstance(data, str))
349355
):
350356
# dicts are technically iterable, but it is an iterable on the keys of the dict and is not usually
351357
# intended as an iterable, so we don't transform it.

src/asktable/resources/ats/task.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,9 @@
22

33
from __future__ import annotations
44

5-
from typing import List
6-
75
import httpx
86

9-
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
7+
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr
108
from ..._utils import maybe_transform, async_maybe_transform
119
from ..._compat import cached_property
1210
from ..._resource import SyncAPIResource, AsyncAPIResource
@@ -190,7 +188,7 @@ def run(
190188
ats_id: str,
191189
*,
192190
datasource_id: str,
193-
specific_case_ids: List[str],
191+
specific_case_ids: SequenceNotStr[str],
194192
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
195193
# The extra values given here take precedence over values defined on the client or passed to this method.
196194
extra_headers: Headers | None = None,
@@ -395,7 +393,7 @@ async def run(
395393
ats_id: str,
396394
*,
397395
datasource_id: str,
398-
specific_case_ids: List[str],
396+
specific_case_ids: SequenceNotStr[str],
399397
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
400398
# The extra values given here take precedence over values defined on the client or passed to this method.
401399
extra_headers: Headers | None = None,

src/asktable/resources/bots.py

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
from __future__ import annotations
44

5-
from typing import List, Iterable, Optional
5+
from typing import Iterable, Optional
66

77
import httpx
88

99
from ..types import bot_list_params, bot_create_params, bot_invite_params, bot_update_params
10-
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
10+
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr
1111
from .._utils import maybe_transform, async_maybe_transform
1212
from .._compat import cached_property
1313
from .._resource import SyncAPIResource, AsyncAPIResource
@@ -47,18 +47,18 @@ def with_streaming_response(self) -> BotsResourceWithStreamingResponse:
4747
def create(
4848
self,
4949
*,
50-
datasource_ids: List[str],
50+
datasource_ids: SequenceNotStr[str],
5151
name: str,
5252
color_theme: Optional[str] | NotGiven = NOT_GIVEN,
5353
debug: bool | NotGiven = NOT_GIVEN,
54-
extapi_ids: List[str] | NotGiven = NOT_GIVEN,
54+
extapi_ids: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
5555
interaction_rules: Iterable[bot_create_params.InteractionRule] | NotGiven = NOT_GIVEN,
5656
magic_input: Optional[str] | NotGiven = NOT_GIVEN,
5757
max_rows: int | NotGiven = NOT_GIVEN,
5858
publish: bool | NotGiven = NOT_GIVEN,
5959
query_balance: Optional[int] | NotGiven = NOT_GIVEN,
60-
sample_questions: Optional[List[str]] | NotGiven = NOT_GIVEN,
61-
webhooks: List[str] | NotGiven = NOT_GIVEN,
60+
sample_questions: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
61+
webhooks: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
6262
welcome_message: Optional[str] | NotGiven = NOT_GIVEN,
6363
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
6464
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -170,17 +170,17 @@ def update(
170170
*,
171171
avatar_url: Optional[str] | NotGiven = NOT_GIVEN,
172172
color_theme: Optional[str] | NotGiven = NOT_GIVEN,
173-
datasource_ids: Optional[List[str]] | NotGiven = NOT_GIVEN,
173+
datasource_ids: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
174174
debug: Optional[bool] | NotGiven = NOT_GIVEN,
175-
extapi_ids: Optional[List[str]] | NotGiven = NOT_GIVEN,
175+
extapi_ids: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
176176
interaction_rules: Optional[Iterable[bot_update_params.InteractionRule]] | NotGiven = NOT_GIVEN,
177177
magic_input: Optional[str] | NotGiven = NOT_GIVEN,
178178
max_rows: Optional[int] | NotGiven = NOT_GIVEN,
179179
name: Optional[str] | NotGiven = NOT_GIVEN,
180180
publish: Optional[bool] | NotGiven = NOT_GIVEN,
181181
query_balance: Optional[int] | NotGiven = NOT_GIVEN,
182-
sample_questions: Optional[List[str]] | NotGiven = NOT_GIVEN,
183-
webhooks: Optional[List[str]] | NotGiven = NOT_GIVEN,
182+
sample_questions: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
183+
webhooks: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
184184
welcome_message: Optional[str] | NotGiven = NOT_GIVEN,
185185
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
186186
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -261,7 +261,7 @@ def update(
261261
def list(
262262
self,
263263
*,
264-
bot_ids: Optional[List[str]] | NotGiven = NOT_GIVEN,
264+
bot_ids: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
265265
name: Optional[str] | NotGiven = NOT_GIVEN,
266266
page: int | NotGiven = NOT_GIVEN,
267267
size: int | NotGiven = NOT_GIVEN,
@@ -408,18 +408,18 @@ def with_streaming_response(self) -> AsyncBotsResourceWithStreamingResponse:
408408
async def create(
409409
self,
410410
*,
411-
datasource_ids: List[str],
411+
datasource_ids: SequenceNotStr[str],
412412
name: str,
413413
color_theme: Optional[str] | NotGiven = NOT_GIVEN,
414414
debug: bool | NotGiven = NOT_GIVEN,
415-
extapi_ids: List[str] | NotGiven = NOT_GIVEN,
415+
extapi_ids: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
416416
interaction_rules: Iterable[bot_create_params.InteractionRule] | NotGiven = NOT_GIVEN,
417417
magic_input: Optional[str] | NotGiven = NOT_GIVEN,
418418
max_rows: int | NotGiven = NOT_GIVEN,
419419
publish: bool | NotGiven = NOT_GIVEN,
420420
query_balance: Optional[int] | NotGiven = NOT_GIVEN,
421-
sample_questions: Optional[List[str]] | NotGiven = NOT_GIVEN,
422-
webhooks: List[str] | NotGiven = NOT_GIVEN,
421+
sample_questions: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
422+
webhooks: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
423423
welcome_message: Optional[str] | NotGiven = NOT_GIVEN,
424424
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
425425
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -531,17 +531,17 @@ async def update(
531531
*,
532532
avatar_url: Optional[str] | NotGiven = NOT_GIVEN,
533533
color_theme: Optional[str] | NotGiven = NOT_GIVEN,
534-
datasource_ids: Optional[List[str]] | NotGiven = NOT_GIVEN,
534+
datasource_ids: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
535535
debug: Optional[bool] | NotGiven = NOT_GIVEN,
536-
extapi_ids: Optional[List[str]] | NotGiven = NOT_GIVEN,
536+
extapi_ids: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
537537
interaction_rules: Optional[Iterable[bot_update_params.InteractionRule]] | NotGiven = NOT_GIVEN,
538538
magic_input: Optional[str] | NotGiven = NOT_GIVEN,
539539
max_rows: Optional[int] | NotGiven = NOT_GIVEN,
540540
name: Optional[str] | NotGiven = NOT_GIVEN,
541541
publish: Optional[bool] | NotGiven = NOT_GIVEN,
542542
query_balance: Optional[int] | NotGiven = NOT_GIVEN,
543-
sample_questions: Optional[List[str]] | NotGiven = NOT_GIVEN,
544-
webhooks: Optional[List[str]] | NotGiven = NOT_GIVEN,
543+
sample_questions: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
544+
webhooks: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
545545
welcome_message: Optional[str] | NotGiven = NOT_GIVEN,
546546
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
547547
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -622,7 +622,7 @@ async def update(
622622
def list(
623623
self,
624624
*,
625-
bot_ids: Optional[List[str]] | NotGiven = NOT_GIVEN,
625+
bot_ids: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
626626
name: Optional[str] | NotGiven = NOT_GIVEN,
627627
page: int | NotGiven = NOT_GIVEN,
628628
size: int | NotGiven = NOT_GIVEN,

src/asktable/resources/business_glossary.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
from __future__ import annotations
44

5-
from typing import List, Iterable, Optional
5+
from typing import Iterable, Optional
66

77
import httpx
88

99
from ..types import business_glossary_list_params, business_glossary_create_params, business_glossary_update_params
10-
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
10+
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr
1111
from .._utils import maybe_transform, async_maybe_transform
1212
from .._compat import cached_property
1313
from .._resource import SyncAPIResource, AsyncAPIResource
@@ -116,7 +116,7 @@ def update(
116116
entry_id: str,
117117
*,
118118
active: Optional[bool] | NotGiven = NOT_GIVEN,
119-
aliases: Optional[List[str]] | NotGiven = NOT_GIVEN,
119+
aliases: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
120120
definition: Optional[str] | NotGiven = NOT_GIVEN,
121121
payload: Optional[object] | NotGiven = NOT_GIVEN,
122122
term: Optional[str] | NotGiven = NOT_GIVEN,
@@ -344,7 +344,7 @@ async def update(
344344
entry_id: str,
345345
*,
346346
active: Optional[bool] | NotGiven = NOT_GIVEN,
347-
aliases: Optional[List[str]] | NotGiven = NOT_GIVEN,
347+
aliases: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
348348
definition: Optional[str] | NotGiven = NOT_GIVEN,
349349
payload: Optional[object] | NotGiven = NOT_GIVEN,
350350
term: Optional[str] | NotGiven = NOT_GIVEN,

src/asktable/resources/datasources/meta.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
from __future__ import annotations
44

5-
from typing import Dict, List, Optional
5+
from typing import Dict, Optional
66

77
import httpx
88

9-
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
9+
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr
1010
from ..._utils import maybe_transform, async_maybe_transform
1111
from ..._compat import cached_property
1212
from ..._resource import SyncAPIResource, AsyncAPIResource
@@ -50,7 +50,7 @@ def create(
5050
async_process_meta: bool | NotGiven = NOT_GIVEN,
5151
value_index: bool | NotGiven = NOT_GIVEN,
5252
meta: Optional[meta_create_params.Meta] | NotGiven = NOT_GIVEN,
53-
selected_tables: Optional[Dict[str, List[str]]] | NotGiven = NOT_GIVEN,
53+
selected_tables: Optional[Dict[str, SequenceNotStr[str]]] | NotGiven = NOT_GIVEN,
5454
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
5555
# The extra values given here take precedence over values defined on the client or passed to this method.
5656
extra_headers: Headers | None = None,
@@ -140,7 +140,7 @@ def update(
140140
*,
141141
async_process_meta: bool | NotGiven = NOT_GIVEN,
142142
meta: Optional[meta_update_params.Meta] | NotGiven = NOT_GIVEN,
143-
selected_tables: Optional[Dict[str, List[str]]] | NotGiven = NOT_GIVEN,
143+
selected_tables: Optional[Dict[str, SequenceNotStr[str]]] | NotGiven = NOT_GIVEN,
144144
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
145145
# The extra values given here take precedence over values defined on the client or passed to this method.
146146
extra_headers: Headers | None = None,
@@ -244,7 +244,7 @@ async def create(
244244
async_process_meta: bool | NotGiven = NOT_GIVEN,
245245
value_index: bool | NotGiven = NOT_GIVEN,
246246
meta: Optional[meta_create_params.Meta] | NotGiven = NOT_GIVEN,
247-
selected_tables: Optional[Dict[str, List[str]]] | NotGiven = NOT_GIVEN,
247+
selected_tables: Optional[Dict[str, SequenceNotStr[str]]] | NotGiven = NOT_GIVEN,
248248
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
249249
# The extra values given here take precedence over values defined on the client or passed to this method.
250250
extra_headers: Headers | None = None,
@@ -334,7 +334,7 @@ async def update(
334334
*,
335335
async_process_meta: bool | NotGiven = NOT_GIVEN,
336336
meta: Optional[meta_update_params.Meta] | NotGiven = NOT_GIVEN,
337-
selected_tables: Optional[Dict[str, List[str]]] | NotGiven = NOT_GIVEN,
337+
selected_tables: Optional[Dict[str, SequenceNotStr[str]]] | NotGiven = NOT_GIVEN,
338338
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
339339
# The extra values given here take precedence over values defined on the client or passed to this method.
340340
extra_headers: Headers | None = None,

src/asktable/resources/policies.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
from __future__ import annotations
44

5-
from typing import List, Optional
5+
from typing import Optional
66
from typing_extensions import Literal
77

88
import httpx
99

1010
from ..types import policy_list_params, policy_create_params, policy_update_params
11-
from .._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven
11+
from .._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven, SequenceNotStr
1212
from .._utils import maybe_transform, async_maybe_transform
1313
from .._compat import cached_property
1414
from .._resource import SyncAPIResource, AsyncAPIResource
@@ -180,7 +180,7 @@ def list(
180180
*,
181181
name: Optional[str] | NotGiven = NOT_GIVEN,
182182
page: int | NotGiven = NOT_GIVEN,
183-
policy_ids: Optional[List[str]] | NotGiven = NOT_GIVEN,
183+
policy_ids: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
184184
size: int | NotGiven = NOT_GIVEN,
185185
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
186186
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -420,7 +420,7 @@ def list(
420420
*,
421421
name: Optional[str] | NotGiven = NOT_GIVEN,
422422
page: int | NotGiven = NOT_GIVEN,
423-
policy_ids: Optional[List[str]] | NotGiven = NOT_GIVEN,
423+
policy_ids: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
424424
size: int | NotGiven = NOT_GIVEN,
425425
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
426426
# The extra values given here take precedence over values defined on the client or passed to this method.

0 commit comments

Comments
 (0)