Skip to content

Commit 7a4eb7b

Browse files
feat(types): replace List[str] with SequenceNotStr in params
1 parent 8427f8a commit 7a4eb7b

33 files changed

+128
-91
lines changed

src/orb/_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/orb/resources/customers/customers.py

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

33
from __future__ import annotations
44

5-
from typing import Dict, List, Union, Optional
5+
from typing import Dict, Union, Optional
66
from datetime import datetime
77
from typing_extensions import Literal
88

@@ -23,7 +23,7 @@
2323
customer_update_params,
2424
customer_update_by_external_id_params,
2525
)
26-
from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven
26+
from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven, SequenceNotStr
2727
from ..._utils import maybe_transform, async_maybe_transform
2828
from ..._compat import cached_property
2929
from ..._resource import SyncAPIResource, AsyncAPIResource
@@ -94,7 +94,7 @@ def create(
9494
email: str,
9595
name: str,
9696
accounting_sync_configuration: Optional[NewAccountingSyncConfigurationParam] | NotGiven = NOT_GIVEN,
97-
additional_emails: Optional[List[str]] | NotGiven = NOT_GIVEN,
97+
additional_emails: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
9898
auto_collection: Optional[bool] | NotGiven = NOT_GIVEN,
9999
billing_address: Optional[AddressInputParam] | NotGiven = NOT_GIVEN,
100100
currency: Optional[str] | NotGiven = NOT_GIVEN,
@@ -365,7 +365,7 @@ def update(
365365
customer_id: str,
366366
*,
367367
accounting_sync_configuration: Optional[NewAccountingSyncConfigurationParam] | NotGiven = NOT_GIVEN,
368-
additional_emails: Optional[List[str]] | NotGiven = NOT_GIVEN,
368+
additional_emails: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
369369
auto_collection: Optional[bool] | NotGiven = NOT_GIVEN,
370370
billing_address: Optional[AddressInputParam] | NotGiven = NOT_GIVEN,
371371
currency: Optional[str] | NotGiven = NOT_GIVEN,
@@ -917,7 +917,7 @@ def update_by_external_id(
917917
id: str,
918918
*,
919919
accounting_sync_configuration: Optional[NewAccountingSyncConfigurationParam] | NotGiven = NOT_GIVEN,
920-
additional_emails: Optional[List[str]] | NotGiven = NOT_GIVEN,
920+
additional_emails: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
921921
auto_collection: Optional[bool] | NotGiven = NOT_GIVEN,
922922
billing_address: Optional[AddressInputParam] | NotGiven = NOT_GIVEN,
923923
currency: Optional[str] | NotGiven = NOT_GIVEN,
@@ -1216,7 +1216,7 @@ async def create(
12161216
email: str,
12171217
name: str,
12181218
accounting_sync_configuration: Optional[NewAccountingSyncConfigurationParam] | NotGiven = NOT_GIVEN,
1219-
additional_emails: Optional[List[str]] | NotGiven = NOT_GIVEN,
1219+
additional_emails: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
12201220
auto_collection: Optional[bool] | NotGiven = NOT_GIVEN,
12211221
billing_address: Optional[AddressInputParam] | NotGiven = NOT_GIVEN,
12221222
currency: Optional[str] | NotGiven = NOT_GIVEN,
@@ -1487,7 +1487,7 @@ async def update(
14871487
customer_id: str,
14881488
*,
14891489
accounting_sync_configuration: Optional[NewAccountingSyncConfigurationParam] | NotGiven = NOT_GIVEN,
1490-
additional_emails: Optional[List[str]] | NotGiven = NOT_GIVEN,
1490+
additional_emails: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
14911491
auto_collection: Optional[bool] | NotGiven = NOT_GIVEN,
14921492
billing_address: Optional[AddressInputParam] | NotGiven = NOT_GIVEN,
14931493
currency: Optional[str] | NotGiven = NOT_GIVEN,
@@ -2039,7 +2039,7 @@ async def update_by_external_id(
20392039
id: str,
20402040
*,
20412041
accounting_sync_configuration: Optional[NewAccountingSyncConfigurationParam] | NotGiven = NOT_GIVEN,
2042-
additional_emails: Optional[List[str]] | NotGiven = NOT_GIVEN,
2042+
additional_emails: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
20432043
auto_collection: Optional[bool] | NotGiven = NOT_GIVEN,
20442044
billing_address: Optional[AddressInputParam] | NotGiven = NOT_GIVEN,
20452045
currency: Optional[str] | NotGiven = NOT_GIVEN,

src/orb/resources/dimensional_price_groups/dimensional_price_groups.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
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

@@ -12,7 +12,7 @@
1212
dimensional_price_group_create_params,
1313
dimensional_price_group_update_params,
1414
)
15-
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
15+
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr
1616
from ..._utils import maybe_transform, async_maybe_transform
1717
from ..._compat import cached_property
1818
from ..._resource import SyncAPIResource, AsyncAPIResource
@@ -60,7 +60,7 @@ def create(
6060
self,
6161
*,
6262
billable_metric_id: str,
63-
dimensions: List[str],
63+
dimensions: SequenceNotStr[str],
6464
name: str,
6565
external_dimensional_price_group_id: Optional[str] | NotGiven = NOT_GIVEN,
6666
metadata: Optional[Dict[str, Optional[str]]] | NotGiven = NOT_GIVEN,
@@ -296,7 +296,7 @@ async def create(
296296
self,
297297
*,
298298
billable_metric_id: str,
299-
dimensions: List[str],
299+
dimensions: SequenceNotStr[str],
300300
name: str,
301301
external_dimensional_price_group_id: Optional[str] | NotGiven = NOT_GIVEN,
302302
metadata: Optional[Dict[str, Optional[str]]] | NotGiven = NOT_GIVEN,

src/orb/resources/events/events.py

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

33
from __future__ import annotations
44

5-
from typing import Dict, List, Union, Iterable, Optional
5+
from typing import Dict, Union, Iterable, Optional
66
from datetime import datetime
77

88
import httpx
@@ -17,7 +17,7 @@
1717
AsyncVolumeWithStreamingResponse,
1818
)
1919
from ...types import event_ingest_params, event_search_params, event_update_params
20-
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
20+
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr
2121
from ..._utils import maybe_transform, async_maybe_transform
2222
from ..._compat import cached_property
2323
from .backfills import (
@@ -519,7 +519,7 @@ def ingest(
519519
def search(
520520
self,
521521
*,
522-
event_ids: List[str],
522+
event_ids: SequenceNotStr[str],
523523
timeframe_end: Union[str, datetime, None] | NotGiven = NOT_GIVEN,
524524
timeframe_start: Union[str, datetime, None] | NotGiven = NOT_GIVEN,
525525
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -1070,7 +1070,7 @@ async def ingest(
10701070
async def search(
10711071
self,
10721072
*,
1073-
event_ids: List[str],
1073+
event_ids: SequenceNotStr[str],
10741074
timeframe_end: Union[str, datetime, None] | NotGiven = NOT_GIVEN,
10751075
timeframe_start: Union[str, datetime, None] | NotGiven = NOT_GIVEN,
10761076
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.

src/orb/resources/prices/prices.py

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

33
from __future__ import annotations
44

5-
from typing import Any, Dict, List, Union, Iterable, Optional, cast
5+
from typing import Any, Dict, Union, Iterable, Optional, cast
66
from datetime import datetime
77
from typing_extensions import Literal, overload
88

@@ -17,7 +17,7 @@
1717
price_evaluate_multiple_params,
1818
price_evaluate_preview_events_params,
1919
)
20-
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
20+
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr
2121
from ..._utils import required_args, maybe_transform, async_maybe_transform
2222
from ..._compat import cached_property
2323
from ..._resource import SyncAPIResource, AsyncAPIResource
@@ -2948,7 +2948,7 @@ def evaluate(
29482948
customer_id: Optional[str] | NotGiven = NOT_GIVEN,
29492949
external_customer_id: Optional[str] | NotGiven = NOT_GIVEN,
29502950
filter: Optional[str] | NotGiven = NOT_GIVEN,
2951-
grouping_keys: List[str] | NotGiven = NOT_GIVEN,
2951+
grouping_keys: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
29522952
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
29532953
# The extra values given here take precedence over values defined on the client or passed to this method.
29542954
extra_headers: Headers | None = None,
@@ -6143,7 +6143,7 @@ async def evaluate(
61436143
customer_id: Optional[str] | NotGiven = NOT_GIVEN,
61446144
external_customer_id: Optional[str] | NotGiven = NOT_GIVEN,
61456145
filter: Optional[str] | NotGiven = NOT_GIVEN,
6146-
grouping_keys: List[str] | NotGiven = NOT_GIVEN,
6146+
grouping_keys: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
61476147
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
61486148
# The extra values given here take precedence over values defined on the client or passed to this method.
61496149
extra_headers: Headers | None = None,

src/orb/resources/subscriptions.py

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

33
from __future__ import annotations
44

5-
from typing import Any, Dict, List, Union, Iterable, Optional, cast
5+
from typing import Any, Dict, Union, Iterable, Optional, cast
66
from datetime import date, datetime
77
from typing_extensions import Literal
88

@@ -25,7 +25,7 @@
2525
subscription_update_fixed_fee_quantity_params,
2626
subscription_unschedule_fixed_fee_quantity_updates_params,
2727
)
28-
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
28+
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr
2929
from .._utils import maybe_transform, async_maybe_transform
3030
from .._compat import cached_property
3131
from .._resource import SyncAPIResource, AsyncAPIResource
@@ -97,7 +97,7 @@ def create(
9797
replace_prices: Optional[Iterable[subscription_create_params.ReplacePrice]] | NotGiven = NOT_GIVEN,
9898
start_date: Union[str, datetime, None] | NotGiven = NOT_GIVEN,
9999
trial_duration_days: Optional[int] | NotGiven = NOT_GIVEN,
100-
usage_customer_ids: Optional[List[str]] | NotGiven = NOT_GIVEN,
100+
usage_customer_ids: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
101101
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
102102
# The extra values given here take precedence over values defined on the client or passed to this method.
103103
extra_headers: Headers | None = None,
@@ -588,8 +588,8 @@ def list(
588588
created_at_lt: Union[str, datetime, None] | NotGiven = NOT_GIVEN,
589589
created_at_lte: Union[str, datetime, None] | NotGiven = NOT_GIVEN,
590590
cursor: Optional[str] | NotGiven = NOT_GIVEN,
591-
customer_id: Optional[List[str]] | NotGiven = NOT_GIVEN,
592-
external_customer_id: Optional[List[str]] | NotGiven = NOT_GIVEN,
591+
customer_id: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
592+
external_customer_id: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
593593
limit: int | NotGiven = NOT_GIVEN,
594594
status: Optional[Literal["active", "ended", "upcoming"]] | NotGiven = NOT_GIVEN,
595595
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -1449,7 +1449,7 @@ def schedule_plan_change(
14491449
replace_prices: Optional[Iterable[subscription_schedule_plan_change_params.ReplacePrice]]
14501450
| NotGiven = NOT_GIVEN,
14511451
trial_duration_days: Optional[int] | NotGiven = NOT_GIVEN,
1452-
usage_customer_ids: Optional[List[str]] | NotGiven = NOT_GIVEN,
1452+
usage_customer_ids: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
14531453
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
14541454
# The extra values given here take precedence over values defined on the client or passed to this method.
14551455
extra_headers: Headers | None = None,
@@ -2183,7 +2183,7 @@ async def create(
21832183
replace_prices: Optional[Iterable[subscription_create_params.ReplacePrice]] | NotGiven = NOT_GIVEN,
21842184
start_date: Union[str, datetime, None] | NotGiven = NOT_GIVEN,
21852185
trial_duration_days: Optional[int] | NotGiven = NOT_GIVEN,
2186-
usage_customer_ids: Optional[List[str]] | NotGiven = NOT_GIVEN,
2186+
usage_customer_ids: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
21872187
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
21882188
# The extra values given here take precedence over values defined on the client or passed to this method.
21892189
extra_headers: Headers | None = None,
@@ -2674,8 +2674,8 @@ def list(
26742674
created_at_lt: Union[str, datetime, None] | NotGiven = NOT_GIVEN,
26752675
created_at_lte: Union[str, datetime, None] | NotGiven = NOT_GIVEN,
26762676
cursor: Optional[str] | NotGiven = NOT_GIVEN,
2677-
customer_id: Optional[List[str]] | NotGiven = NOT_GIVEN,
2678-
external_customer_id: Optional[List[str]] | NotGiven = NOT_GIVEN,
2677+
customer_id: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
2678+
external_customer_id: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
26792679
limit: int | NotGiven = NOT_GIVEN,
26802680
status: Optional[Literal["active", "ended", "upcoming"]] | NotGiven = NOT_GIVEN,
26812681
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -3535,7 +3535,7 @@ async def schedule_plan_change(
35353535
replace_prices: Optional[Iterable[subscription_schedule_plan_change_params.ReplacePrice]]
35363536
| NotGiven = NOT_GIVEN,
35373537
trial_duration_days: Optional[int] | NotGiven = NOT_GIVEN,
3538-
usage_customer_ids: Optional[List[str]] | NotGiven = NOT_GIVEN,
3538+
usage_customer_ids: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
35393539
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
35403540
# The extra values given here take precedence over values defined on the client or passed to this method.
35413541
extra_headers: Headers | None = None,

src/orb/types/customer_create_params.py

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

33
from __future__ import annotations
44

5-
from typing import Dict, List, Union, Optional
5+
from typing import Dict, Union, Optional
66
from typing_extensions import Literal, Required, TypeAlias, TypedDict
77

8+
from .._types import SequenceNotStr
89
from .address_input_param import AddressInputParam
910
from .shared_params.customer_tax_id import CustomerTaxID
1011
from .new_sphere_configuration_param import NewSphereConfigurationParam
@@ -30,7 +31,7 @@ class CustomerCreateParams(TypedDict, total=False):
3031

3132
accounting_sync_configuration: Optional[NewAccountingSyncConfigurationParam]
3233

33-
additional_emails: Optional[List[str]]
34+
additional_emails: Optional[SequenceNotStr[str]]
3435
"""Additional email addresses for this customer.
3536
3637
If populated, these email addresses will be CC'd for customer communications.

src/orb/types/customer_hierarchy_config_param.py

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

33
from __future__ import annotations
44

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

8+
from .._types import SequenceNotStr
9+
810
__all__ = ["CustomerHierarchyConfigParam"]
911

1012

1113
class CustomerHierarchyConfigParam(TypedDict, total=False):
12-
child_customer_ids: List[str]
14+
child_customer_ids: SequenceNotStr[str]
1315
"""A list of child customer IDs to add to the hierarchy.
1416
1517
The desired child customers must not already be part of another hierarchy.

src/orb/types/customer_update_by_external_id_params.py

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

33
from __future__ import annotations
44

5-
from typing import Dict, List, Union, Optional
5+
from typing import Dict, Union, Optional
66
from typing_extensions import Literal, TypeAlias, TypedDict
77

8+
from .._types import SequenceNotStr
89
from .address_input_param import AddressInputParam
910
from .shared_params.customer_tax_id import CustomerTaxID
1011
from .new_sphere_configuration_param import NewSphereConfigurationParam
@@ -20,7 +21,7 @@
2021
class CustomerUpdateByExternalIDParams(TypedDict, total=False):
2122
accounting_sync_configuration: Optional[NewAccountingSyncConfigurationParam]
2223

23-
additional_emails: Optional[List[str]]
24+
additional_emails: Optional[SequenceNotStr[str]]
2425
"""Additional email addresses for this customer.
2526
2627
If populated, these email addresses will be CC'd for customer communications.

src/orb/types/customer_update_params.py

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

33
from __future__ import annotations
44

5-
from typing import Dict, List, Union, Optional
5+
from typing import Dict, Union, Optional
66
from typing_extensions import Literal, TypeAlias, TypedDict
77

8+
from .._types import SequenceNotStr
89
from .address_input_param import AddressInputParam
910
from .shared_params.customer_tax_id import CustomerTaxID
1011
from .new_sphere_configuration_param import NewSphereConfigurationParam
@@ -20,7 +21,7 @@
2021
class CustomerUpdateParams(TypedDict, total=False):
2122
accounting_sync_configuration: Optional[NewAccountingSyncConfigurationParam]
2223

23-
additional_emails: Optional[List[str]]
24+
additional_emails: Optional[SequenceNotStr[str]]
2425
"""Additional email addresses for this customer.
2526
2627
If populated, these email addresses will be CC'd for customer communications.

0 commit comments

Comments
 (0)