Skip to content

Commit 25daef9

Browse files
feat(types): replace List[str] with SequenceNotStr in params
1 parent 79d2776 commit 25daef9

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

src/lmnt/_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/lmnt/resources/voices.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, Mapping, cast
5+
from typing import Mapping, cast
66

77
import httpx
88

99
from ..types import voice_list_params, voice_create_params, voice_update_params
10-
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven, FileTypes
10+
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven, FileTypes, SequenceNotStr
1111
from .._utils import extract_files, maybe_transform, deepcopy_minimal, async_maybe_transform
1212
from .._compat import cached_property
1313
from .._resource import SyncAPIResource, AsyncAPIResource
@@ -50,7 +50,7 @@ def create(
5050
self,
5151
*,
5252
enhance: bool,
53-
files: List[FileTypes],
53+
files: SequenceNotStr[FileTypes],
5454
name: str,
5555
description: str | NotGiven = NOT_GIVEN,
5656
gender: str | NotGiven = NOT_GIVEN,
@@ -309,7 +309,7 @@ async def create(
309309
self,
310310
*,
311311
enhance: bool,
312-
files: List[FileTypes],
312+
files: SequenceNotStr[FileTypes],
313313
name: str,
314314
description: str | NotGiven = NOT_GIVEN,
315315
gender: str | NotGiven = NOT_GIVEN,

src/lmnt/types/voice_create_params.py

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

33
from __future__ import annotations
44

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

8-
from .._types import FileTypes
7+
from .._types import FileTypes, SequenceNotStr
98

109
__all__ = ["VoiceCreateParams"]
1110

@@ -18,7 +17,7 @@ class VoiceCreateParams(TypedDict, total=False):
1817
circumstances.
1918
"""
2019

21-
files: Required[List[FileTypes]]
20+
files: Required[SequenceNotStr[FileTypes]]
2221
"""
2322
One or more input audio files to train the voice in the form of binary `wav`,
2423
`mp3`, `mp4`, `m4a`, or `webm` attachments.

0 commit comments

Comments
 (0)