Skip to content

Commit 7d41d8f

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

File tree

12 files changed

+41
-31
lines changed

12 files changed

+41
-31
lines changed

src/finch/_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/finch/resources/hris/benefits/individuals.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
5+
from typing import Iterable
66

77
import httpx
88

99
from .... import _legacy_response
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
@@ -170,7 +170,7 @@ def unenroll_many(
170170
self,
171171
benefit_id: str,
172172
*,
173-
individual_ids: List[str] | NotGiven = NOT_GIVEN,
173+
individual_ids: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
174174
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
175175
# The extra values given here take precedence over values defined on the client or passed to this method.
176176
extra_headers: Headers | None = None,
@@ -349,7 +349,7 @@ async def unenroll_many(
349349
self,
350350
benefit_id: str,
351351
*,
352-
individual_ids: List[str] | NotGiven = NOT_GIVEN,
352+
individual_ids: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
353353
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
354354
# The extra values given here take precedence over values defined on the client or passed to this method.
355355
extra_headers: Headers | None = None,

src/finch/resources/hris/documents.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import httpx
99

1010
from ... import _legacy_response
11-
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
11+
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr
1212
from ..._utils import maybe_transform, async_maybe_transform
1313
from ..._compat import cached_property
1414
from ..._resource import SyncAPIResource, AsyncAPIResource
@@ -44,7 +44,7 @@ def with_streaming_response(self) -> DocumentsWithStreamingResponse:
4444
def list(
4545
self,
4646
*,
47-
individual_ids: List[str] | NotGiven = NOT_GIVEN,
47+
individual_ids: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
4848
limit: int | NotGiven = NOT_GIVEN,
4949
offset: int | NotGiven = NOT_GIVEN,
5050
types: List[Literal["w4_2020", "w4_2005"]] | NotGiven = NOT_GIVEN,
@@ -163,7 +163,7 @@ def with_streaming_response(self) -> AsyncDocumentsWithStreamingResponse:
163163
async def list(
164164
self,
165165
*,
166-
individual_ids: List[str] | NotGiven = NOT_GIVEN,
166+
individual_ids: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
167167
limit: int | NotGiven = NOT_GIVEN,
168168
offset: int | NotGiven = NOT_GIVEN,
169169
types: List[Literal["w4_2020", "w4_2005"]] | NotGiven = NOT_GIVEN,

src/finch/resources/payroll/pay_groups.py

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

33
from __future__ import annotations
44

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

97
from ... import _legacy_response
10-
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
8+
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr
119
from ..._utils import maybe_transform
1210
from ..._compat import cached_property
1311
from ..._resource import SyncAPIResource, AsyncAPIResource
@@ -78,7 +76,7 @@ def list(
7876
self,
7977
*,
8078
individual_id: str | NotGiven = NOT_GIVEN,
81-
pay_frequencies: List[str] | NotGiven = NOT_GIVEN,
79+
pay_frequencies: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
8280
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
8381
# The extra values given here take precedence over values defined on the client or passed to this method.
8482
extra_headers: Headers | None = None,
@@ -175,7 +173,7 @@ def list(
175173
self,
176174
*,
177175
individual_id: str | NotGiven = NOT_GIVEN,
178-
pay_frequencies: List[str] | NotGiven = NOT_GIVEN,
176+
pay_frequencies: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
179177
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
180178
# The extra values given here take precedence over values defined on the client or passed to this method.
181179
extra_headers: Headers | None = None,

src/finch/resources/sandbox/connections/accounts.py

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

33
from __future__ import annotations
44

5-
from typing import List
65
from typing_extensions import Literal
76

87
import httpx
98

109
from .... import _legacy_response
11-
from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
10+
from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr
1211
from ...._utils import maybe_transform, async_maybe_transform
1312
from ...._compat import cached_property
1413
from ...._resource import SyncAPIResource, AsyncAPIResource
@@ -48,7 +47,7 @@ def create(
4847
company_id: str,
4948
provider_id: str,
5049
authentication_type: Literal["credential", "api_token", "oauth", "assisted"] | NotGiven = NOT_GIVEN,
51-
products: List[str] | NotGiven = NOT_GIVEN,
50+
products: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
5251
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
5352
# The extra values given here take precedence over values defined on the client or passed to this method.
5453
extra_headers: Headers | None = None,
@@ -151,7 +150,7 @@ async def create(
151150
company_id: str,
152151
provider_id: str,
153152
authentication_type: Literal["credential", "api_token", "oauth", "assisted"] | NotGiven = NOT_GIVEN,
154-
products: List[str] | NotGiven = NOT_GIVEN,
153+
products: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
155154
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
156155
# The extra values given here take precedence over values defined on the client or passed to this method.
157156
extra_headers: Headers | None = None,

src/finch/resources/sandbox/connections/connections.py

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

33
from __future__ import annotations
44

5-
from typing import List
65
from typing_extensions import Literal
76

87
import httpx
@@ -16,7 +15,7 @@
1615
AccountsWithStreamingResponse,
1716
AsyncAccountsWithStreamingResponse,
1817
)
19-
from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
18+
from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr
2019
from ...._utils import maybe_transform, async_maybe_transform
2120
from ...._compat import cached_property
2221
from ...._resource import SyncAPIResource, AsyncAPIResource
@@ -58,7 +57,7 @@ def create(
5857
provider_id: str,
5958
authentication_type: Literal["credential", "api_token", "oauth", "assisted"] | NotGiven = NOT_GIVEN,
6059
employee_size: int | NotGiven = NOT_GIVEN,
61-
products: List[str] | NotGiven = NOT_GIVEN,
60+
products: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
6261
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
6362
# The extra values given here take precedence over values defined on the client or passed to this method.
6463
extra_headers: Headers | None = None,
@@ -132,7 +131,7 @@ async def create(
132131
provider_id: str,
133132
authentication_type: Literal["credential", "api_token", "oauth", "assisted"] | NotGiven = NOT_GIVEN,
134133
employee_size: int | NotGiven = NOT_GIVEN,
135-
products: List[str] | NotGiven = NOT_GIVEN,
134+
products: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
136135
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
137136
# The extra values given here take precedence over values defined on the client or passed to this method.
138137
extra_headers: Headers | None = None,

src/finch/types/hris/benefits/individual_unenroll_many_params.py

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

33
from __future__ import annotations
44

5-
from typing import List
65
from typing_extensions import TypedDict
76

7+
from ...._types import SequenceNotStr
8+
89
__all__ = ["IndividualUnenrollManyParams"]
910

1011

1112
class IndividualUnenrollManyParams(TypedDict, total=False):
12-
individual_ids: List[str]
13+
individual_ids: SequenceNotStr[str]
1314
"""Array of individual_ids to unenroll."""

src/finch/types/hris/document_list_params.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@
55
from typing import List
66
from typing_extensions import Literal, TypedDict
77

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

1012

1113
class DocumentListParams(TypedDict, total=False):
12-
individual_ids: List[str]
14+
individual_ids: SequenceNotStr[str]
1315
"""Comma-delimited list of stable Finch uuids for each individual.
1416
1517
If empty, defaults to all individuals

src/finch/types/hris/individual_retrieve_many_params.py

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

33
from __future__ import annotations
44

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

8+
from ..._types import SequenceNotStr
9+
810
__all__ = ["IndividualRetrieveManyParams", "Options", "Request"]
911

1012

@@ -15,7 +17,7 @@ class IndividualRetrieveManyParams(TypedDict, total=False):
1517

1618

1719
class Options(TypedDict, total=False):
18-
include: List[str]
20+
include: SequenceNotStr[str]
1921

2022

2123
class Request(TypedDict, total=False):

src/finch/types/payroll/pay_group_list_params.py

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

33
from __future__ import annotations
44

5-
from typing import List
65
from typing_extensions import TypedDict
76

7+
from ..._types import SequenceNotStr
8+
89
__all__ = ["PayGroupListParams"]
910

1011

1112
class PayGroupListParams(TypedDict, total=False):
1213
individual_id: str
1314

14-
pay_frequencies: List[str]
15+
pay_frequencies: SequenceNotStr[str]

0 commit comments

Comments
 (0)