Skip to content

Commit 9c3bbcd

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

12 files changed

Lines changed: 71 additions & 55 deletions

src/runloop_api_client/_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/runloop_api_client/resources/benchmarks/benchmarks.py

Lines changed: 14 additions & 14 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

@@ -22,7 +22,7 @@
2222
benchmark_definitions_params,
2323
benchmark_list_public_params,
2424
)
25-
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
25+
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr
2626
from ..._utils import maybe_transform, async_maybe_transform
2727
from ..._compat import cached_property
2828
from ..._resource import SyncAPIResource, AsyncAPIResource
@@ -73,9 +73,9 @@ def create(
7373
attribution: Optional[str] | NotGiven = NOT_GIVEN,
7474
description: Optional[str] | NotGiven = NOT_GIVEN,
7575
metadata: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
76-
required_environment_variables: Optional[List[str]] | NotGiven = NOT_GIVEN,
77-
required_secret_names: List[str] | NotGiven = NOT_GIVEN,
78-
scenario_ids: Optional[List[str]] | NotGiven = NOT_GIVEN,
76+
required_environment_variables: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
77+
required_secret_names: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
78+
scenario_ids: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
7979
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
8080
# The extra values given here take precedence over values defined on the client or passed to this method.
8181
extra_headers: Headers | None = None,
@@ -180,9 +180,9 @@ def update(
180180
attribution: Optional[str] | NotGiven = NOT_GIVEN,
181181
description: Optional[str] | NotGiven = NOT_GIVEN,
182182
metadata: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
183-
required_environment_variables: Optional[List[str]] | NotGiven = NOT_GIVEN,
184-
required_secret_names: List[str] | NotGiven = NOT_GIVEN,
185-
scenario_ids: Optional[List[str]] | NotGiven = NOT_GIVEN,
183+
required_environment_variables: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
184+
required_secret_names: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
185+
scenario_ids: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
186186
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
187187
# The extra values given here take precedence over values defined on the client or passed to this method.
188188
extra_headers: Headers | None = None,
@@ -481,9 +481,9 @@ async def create(
481481
attribution: Optional[str] | NotGiven = NOT_GIVEN,
482482
description: Optional[str] | NotGiven = NOT_GIVEN,
483483
metadata: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
484-
required_environment_variables: Optional[List[str]] | NotGiven = NOT_GIVEN,
485-
required_secret_names: List[str] | NotGiven = NOT_GIVEN,
486-
scenario_ids: Optional[List[str]] | NotGiven = NOT_GIVEN,
484+
required_environment_variables: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
485+
required_secret_names: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
486+
scenario_ids: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
487487
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
488488
# The extra values given here take precedence over values defined on the client or passed to this method.
489489
extra_headers: Headers | None = None,
@@ -588,9 +588,9 @@ async def update(
588588
attribution: Optional[str] | NotGiven = NOT_GIVEN,
589589
description: Optional[str] | NotGiven = NOT_GIVEN,
590590
metadata: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
591-
required_environment_variables: Optional[List[str]] | NotGiven = NOT_GIVEN,
592-
required_secret_names: List[str] | NotGiven = NOT_GIVEN,
593-
scenario_ids: Optional[List[str]] | NotGiven = NOT_GIVEN,
591+
required_environment_variables: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
592+
required_secret_names: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
593+
scenario_ids: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
594594
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
595595
# The extra values given here take precedence over values defined on the client or passed to this method.
596596
extra_headers: Headers | None = None,

src/runloop_api_client/resources/blueprints.py

Lines changed: 6 additions & 6 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, Iterable, Optional, TypedDict
5+
from typing import Dict, Iterable, Optional, TypedDict
66

77
import httpx
88

@@ -12,7 +12,7 @@
1212
blueprint_preview_params,
1313
blueprint_list_public_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
@@ -79,7 +79,7 @@ def create(
7979
launch_parameters: Optional[LaunchParameters] | NotGiven = NOT_GIVEN,
8080
metadata: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
8181
services: Optional[Iterable[blueprint_create_params.Service]] | NotGiven = NOT_GIVEN,
82-
system_setup_commands: Optional[List[str]] | NotGiven = NOT_GIVEN,
82+
system_setup_commands: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
8383
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
8484
# The extra values given here take precedence over values defined on the client or passed to this method.
8585
extra_headers: Headers | None = None,
@@ -478,7 +478,7 @@ def preview(
478478
launch_parameters: Optional[LaunchParameters] | NotGiven = NOT_GIVEN,
479479
metadata: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
480480
services: Optional[Iterable[blueprint_preview_params.Service]] | NotGiven = NOT_GIVEN,
481-
system_setup_commands: Optional[List[str]] | NotGiven = NOT_GIVEN,
481+
system_setup_commands: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
482482
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
483483
# The extra values given here take precedence over values defined on the client or passed to this method.
484484
extra_headers: Headers | None = None,
@@ -582,7 +582,7 @@ async def create(
582582
launch_parameters: Optional[LaunchParameters] | NotGiven = NOT_GIVEN,
583583
metadata: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
584584
services: Optional[Iterable[blueprint_create_params.Service]] | NotGiven = NOT_GIVEN,
585-
system_setup_commands: Optional[List[str]] | NotGiven = NOT_GIVEN,
585+
system_setup_commands: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
586586
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
587587
# The extra values given here take precedence over values defined on the client or passed to this method.
588588
extra_headers: Headers | None = None,
@@ -981,7 +981,7 @@ async def preview(
981981
launch_parameters: Optional[LaunchParameters] | NotGiven = NOT_GIVEN,
982982
metadata: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
983983
services: Optional[Iterable[blueprint_preview_params.Service]] | NotGiven = NOT_GIVEN,
984-
system_setup_commands: Optional[List[str]] | NotGiven = NOT_GIVEN,
984+
system_setup_commands: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
985985
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
986986
# The extra values given here take precedence over values defined on the client or passed to this method.
987987
extra_headers: Headers | None = None,

src/runloop_api_client/resources/scenarios/scenarios.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 Dict, List, Optional
5+
from typing import Dict, Optional
66
from typing_extensions import Literal
77

88
import httpx
@@ -30,7 +30,7 @@
3030
ScorersResourceWithStreamingResponse,
3131
AsyncScorersResourceWithStreamingResponse,
3232
)
33-
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
33+
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr
3434
from ..._utils import maybe_transform, async_maybe_transform
3535
from ..._compat import cached_property
3636
from ..._resource import SyncAPIResource, AsyncAPIResource
@@ -92,8 +92,8 @@ def create(
9292
environment_parameters: Optional[ScenarioEnvironmentParam] | NotGiven = NOT_GIVEN,
9393
metadata: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
9494
reference_output: Optional[str] | NotGiven = NOT_GIVEN,
95-
required_environment_variables: Optional[List[str]] | NotGiven = NOT_GIVEN,
96-
required_secret_names: Optional[List[str]] | NotGiven = NOT_GIVEN,
95+
required_environment_variables: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
96+
required_secret_names: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
9797
validation_type: Optional[Literal["FORWARD", "REVERSE", "EVALUATION"]] | NotGiven = NOT_GIVEN,
9898
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
9999
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -209,8 +209,8 @@ def update(
209209
metadata: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
210210
name: Optional[str] | NotGiven = NOT_GIVEN,
211211
reference_output: Optional[str] | NotGiven = NOT_GIVEN,
212-
required_environment_variables: Optional[List[str]] | NotGiven = NOT_GIVEN,
213-
required_secret_names: Optional[List[str]] | NotGiven = NOT_GIVEN,
212+
required_environment_variables: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
213+
required_secret_names: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
214214
scoring_contract: Optional[ScoringContractUpdateParam] | NotGiven = NOT_GIVEN,
215215
validation_type: Optional[Literal["FORWARD", "REVERSE", "EVALUATION"]] | NotGiven = NOT_GIVEN,
216216
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -549,8 +549,8 @@ async def create(
549549
environment_parameters: Optional[ScenarioEnvironmentParam] | NotGiven = NOT_GIVEN,
550550
metadata: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
551551
reference_output: Optional[str] | NotGiven = NOT_GIVEN,
552-
required_environment_variables: Optional[List[str]] | NotGiven = NOT_GIVEN,
553-
required_secret_names: Optional[List[str]] | NotGiven = NOT_GIVEN,
552+
required_environment_variables: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
553+
required_secret_names: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
554554
validation_type: Optional[Literal["FORWARD", "REVERSE", "EVALUATION"]] | NotGiven = NOT_GIVEN,
555555
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
556556
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -666,8 +666,8 @@ async def update(
666666
metadata: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
667667
name: Optional[str] | NotGiven = NOT_GIVEN,
668668
reference_output: Optional[str] | NotGiven = NOT_GIVEN,
669-
required_environment_variables: Optional[List[str]] | NotGiven = NOT_GIVEN,
670-
required_secret_names: Optional[List[str]] | NotGiven = NOT_GIVEN,
669+
required_environment_variables: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
670+
required_secret_names: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
671671
scoring_contract: Optional[ScoringContractUpdateParam] | NotGiven = NOT_GIVEN,
672672
validation_type: Optional[Literal["FORWARD", "REVERSE", "EVALUATION"]] | NotGiven = NOT_GIVEN,
673673
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.

src/runloop_api_client/types/benchmark_create_params.py

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

33
from __future__ import annotations
44

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

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

1012

@@ -21,18 +23,18 @@ class BenchmarkCreateParams(TypedDict, total=False):
2123
metadata: Optional[Dict[str, str]]
2224
"""User defined metadata to attach to the benchmark for organization."""
2325

24-
required_environment_variables: Optional[List[str]]
26+
required_environment_variables: Optional[SequenceNotStr[str]]
2527
"""Environment variables required to run the benchmark.
2628
2729
If any required variables are not supplied, the benchmark will fail to start
2830
"""
2931

30-
required_secret_names: List[str]
32+
required_secret_names: SequenceNotStr[str]
3133
"""
3234
Secrets required to run the benchmark with (environment variable name will be
3335
mapped to the your user secret by name). If any of these secrets are not
3436
provided or the mapping is incorrect, the benchmark will fail to start.
3537
"""
3638

37-
scenario_ids: Optional[List[str]]
39+
scenario_ids: Optional[SequenceNotStr[str]]
3840
"""The Scenario IDs that make up the Benchmark."""

src/runloop_api_client/types/benchmark_update_params.py

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

33
from __future__ import annotations
44

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

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

1012

@@ -21,18 +23,18 @@ class BenchmarkUpdateParams(TypedDict, total=False):
2123
metadata: Optional[Dict[str, str]]
2224
"""User defined metadata to attach to the benchmark for organization."""
2325

24-
required_environment_variables: Optional[List[str]]
26+
required_environment_variables: Optional[SequenceNotStr[str]]
2527
"""Environment variables required to run the benchmark.
2628
2729
If any required variables are not supplied, the benchmark will fail to start
2830
"""
2931

30-
required_secret_names: List[str]
32+
required_secret_names: SequenceNotStr[str]
3133
"""
3234
Secrets required to run the benchmark with (environment variable name will be
3335
mapped to the your user secret by name). If any of these secrets are not
3436
provided or the mapping is incorrect, the benchmark will fail to start.
3537
"""
3638

37-
scenario_ids: Optional[List[str]]
39+
scenario_ids: Optional[SequenceNotStr[str]]
3840
"""The Scenario IDs that make up the Benchmark."""

src/runloop_api_client/types/blueprint_create_params.py

Lines changed: 4 additions & 3 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, Iterable, Optional
5+
from typing import Dict, Iterable, Optional
66
from typing_extensions import Required, TypedDict
77

8+
from .._types import SequenceNotStr
89
from .shared_params.launch_parameters import LaunchParameters
910
from .shared_params.code_mount_parameters import CodeMountParameters
1011

@@ -43,7 +44,7 @@ class BlueprintCreateParams(TypedDict, total=False):
4344
performance.
4445
"""
4546

46-
system_setup_commands: Optional[List[str]]
47+
system_setup_commands: Optional[SequenceNotStr[str]]
4748
"""A list of commands to run to set up your system."""
4849

4950

@@ -71,7 +72,7 @@ class Service(TypedDict, total=False):
7172
options: Optional[str]
7273
"""Additional Docker container create options."""
7374

74-
port_mappings: Optional[List[str]]
75+
port_mappings: Optional[SequenceNotStr[str]]
7576
"""The port mappings of the container service.
7677
7778
Port mappings are in the format of <host_port>:<container_port>.

src/runloop_api_client/types/blueprint_preview_params.py

Lines changed: 4 additions & 3 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, Iterable, Optional
5+
from typing import Dict, Iterable, Optional
66
from typing_extensions import Required, TypedDict
77

8+
from .._types import SequenceNotStr
89
from .shared_params.launch_parameters import LaunchParameters
910
from .shared_params.code_mount_parameters import CodeMountParameters
1011

@@ -43,7 +44,7 @@ class BlueprintPreviewParams(TypedDict, total=False):
4344
performance.
4445
"""
4546

46-
system_setup_commands: Optional[List[str]]
47+
system_setup_commands: Optional[SequenceNotStr[str]]
4748
"""A list of commands to run to set up your system."""
4849

4950

@@ -71,7 +72,7 @@ class Service(TypedDict, total=False):
7172
options: Optional[str]
7273
"""Additional Docker container create options."""
7374

74-
port_mappings: Optional[List[str]]
75+
port_mappings: Optional[SequenceNotStr[str]]
7576
"""The port mappings of the container service.
7677
7778
Port mappings are in the format of <host_port>:<container_port>.

src/runloop_api_client/types/devboxes/code_action_context_param.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, Iterable
5+
from typing import Dict, Union, Iterable
66
from typing_extensions import Required, Annotated, TypeAlias, TypedDict
77

8+
from ..._types import SequenceNotStr
89
from ..._utils import PropertyInfo
910
from .code_action_kind import CodeActionKind
1011
from .diagnostic_param import DiagnosticParam
@@ -23,7 +24,7 @@ class CodeActionContextParamTyped(TypedDict, total=False):
2324
resource. The primary parameter to compute code actions is the provided range.
2425
"""
2526

26-
only: List[CodeActionKind]
27+
only: SequenceNotStr[CodeActionKind]
2728
"""Requested kind of actions to return.
2829
2930
Actions not of this kind are filtered out by the client before being shown. So

src/runloop_api_client/types/scenario_create_params.py

Lines changed: 4 additions & 3 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, Optional
5+
from typing import Dict, Optional
66
from typing_extensions import Literal, Required, TypedDict
77

8+
from .._types import SequenceNotStr
89
from .input_context_param import InputContextParam
910
from .scoring_contract_param import ScoringContractParam
1011
from .scenario_environment_param import ScenarioEnvironmentParam
@@ -35,13 +36,13 @@ class ScenarioCreateParams(TypedDict, total=False):
3536
apply to the environment.
3637
"""
3738

38-
required_environment_variables: Optional[List[str]]
39+
required_environment_variables: Optional[SequenceNotStr[str]]
3940
"""Environment variables required to run the scenario.
4041
4142
If these variables are not provided, the scenario will fail to start.
4243
"""
4344

44-
required_secret_names: Optional[List[str]]
45+
required_secret_names: Optional[SequenceNotStr[str]]
4546
"""
4647
Secrets required to run the scenario (user secret name to scenario required
4748
secret name). If these secrets are not provided or the mapping is incorrect, the

0 commit comments

Comments
 (0)