Skip to content

Commit 3682734

Browse files
feat(types): replace List[str] with SequenceNotStr in params
1 parent 9cbe921 commit 3682734

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

src/hyperspell/_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/hyperspell/types/memory_search_params.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from datetime import datetime
77
from typing_extensions import Literal, Required, Annotated, TypedDict
88

9+
from .._types import SequenceNotStr
910
from .._utils import PropertyInfo
1011

1112
__all__ = [
@@ -167,7 +168,7 @@ class OptionsGoogleMail(TypedDict, total=False):
167168
before: Annotated[Union[str, datetime, None], PropertyInfo(format="iso8601")]
168169
"""Only query documents created before this date."""
169170

170-
label_ids: List[str]
171+
label_ids: SequenceNotStr[str]
171172
"""List of label IDs to filter messages (e.g., ['INBOX', 'SENT', 'DRAFT']).
172173
173174
Multiple labels are combined with OR logic - messages matching ANY specified
@@ -191,7 +192,7 @@ class OptionsNotion(TypedDict, total=False):
191192
before: Annotated[Union[str, datetime, None], PropertyInfo(format="iso8601")]
192193
"""Only query documents created before this date."""
193194

194-
notion_page_ids: List[str]
195+
notion_page_ids: SequenceNotStr[str]
195196
"""List of Notion page IDs to search.
196197
197198
If not provided, all pages in the workspace will be searched.
@@ -241,7 +242,7 @@ class OptionsSlack(TypedDict, total=False):
241242
before: Annotated[Union[str, datetime, None], PropertyInfo(format="iso8601")]
242243
"""Only query documents created before this date."""
243244

244-
channels: List[str]
245+
channels: SequenceNotStr[str]
245246
"""List of Slack channels to search.
246247
247248
If not provided, all channels in the workspace will be searched.

0 commit comments

Comments
 (0)