runwayml 2.1.4__py3-none-any.whl → 2.1.5__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- runwayml/_models.py +3 -0
- runwayml/_response.py +10 -10
- runwayml/_utils/__init__.py +1 -0
- runwayml/_utils/_typing.py +30 -1
- runwayml/_version.py +1 -1
- {runwayml-2.1.4.dist-info → runwayml-2.1.5.dist-info}/METADATA +2 -2
- {runwayml-2.1.4.dist-info → runwayml-2.1.5.dist-info}/RECORD +9 -9
- {runwayml-2.1.4.dist-info → runwayml-2.1.5.dist-info}/WHEEL +0 -0
- {runwayml-2.1.4.dist-info → runwayml-2.1.5.dist-info}/licenses/LICENSE +0 -0
runwayml/_models.py
CHANGED
@@ -46,6 +46,7 @@ from ._utils import (
|
|
46
46
|
strip_not_given,
|
47
47
|
extract_type_arg,
|
48
48
|
is_annotated_type,
|
49
|
+
is_type_alias_type,
|
49
50
|
strip_annotated_type,
|
50
51
|
)
|
51
52
|
from ._compat import (
|
@@ -428,6 +429,8 @@ def construct_type(*, value: object, type_: object) -> object:
|
|
428
429
|
# we allow `object` as the input type because otherwise, passing things like
|
429
430
|
# `Literal['value']` will be reported as a type error by type checkers
|
430
431
|
type_ = cast("type[object]", type_)
|
432
|
+
if is_type_alias_type(type_):
|
433
|
+
type_ = type_.__value__ # type: ignore[unreachable]
|
431
434
|
|
432
435
|
# unwrap `Annotated[T, ...]` -> `T`
|
433
436
|
if is_annotated_type(type_):
|
runwayml/_response.py
CHANGED
@@ -25,7 +25,7 @@ import httpx
|
|
25
25
|
import pydantic
|
26
26
|
|
27
27
|
from ._types import NoneType
|
28
|
-
from ._utils import is_given, extract_type_arg, is_annotated_type, extract_type_var_from_base
|
28
|
+
from ._utils import is_given, extract_type_arg, is_annotated_type, is_type_alias_type, extract_type_var_from_base
|
29
29
|
from ._models import BaseModel, is_basemodel
|
30
30
|
from ._constants import RAW_RESPONSE_HEADER, OVERRIDE_CAST_TO_HEADER
|
31
31
|
from ._streaming import Stream, AsyncStream, is_stream_class_type, extract_stream_chunk_type
|
@@ -126,9 +126,15 @@ class BaseAPIResponse(Generic[R]):
|
|
126
126
|
)
|
127
127
|
|
128
128
|
def _parse(self, *, to: type[_T] | None = None) -> R | _T:
|
129
|
+
cast_to = to if to is not None else self._cast_to
|
130
|
+
|
131
|
+
# unwrap `TypeAlias('Name', T)` -> `T`
|
132
|
+
if is_type_alias_type(cast_to):
|
133
|
+
cast_to = cast_to.__value__ # type: ignore[unreachable]
|
134
|
+
|
129
135
|
# unwrap `Annotated[T, ...]` -> `T`
|
130
|
-
if
|
131
|
-
|
136
|
+
if cast_to and is_annotated_type(cast_to):
|
137
|
+
cast_to = extract_type_arg(cast_to, 0)
|
132
138
|
|
133
139
|
if self._is_sse_stream:
|
134
140
|
if to:
|
@@ -164,18 +170,12 @@ class BaseAPIResponse(Generic[R]):
|
|
164
170
|
return cast(
|
165
171
|
R,
|
166
172
|
stream_cls(
|
167
|
-
cast_to=
|
173
|
+
cast_to=cast_to,
|
168
174
|
response=self.http_response,
|
169
175
|
client=cast(Any, self._client),
|
170
176
|
),
|
171
177
|
)
|
172
178
|
|
173
|
-
cast_to = to if to is not None else self._cast_to
|
174
|
-
|
175
|
-
# unwrap `Annotated[T, ...]` -> `T`
|
176
|
-
if is_annotated_type(cast_to):
|
177
|
-
cast_to = extract_type_arg(cast_to, 0)
|
178
|
-
|
179
179
|
if cast_to is NoneType:
|
180
180
|
return cast(R, None)
|
181
181
|
|
runwayml/_utils/__init__.py
CHANGED
@@ -39,6 +39,7 @@ from ._typing import (
|
|
39
39
|
is_iterable_type as is_iterable_type,
|
40
40
|
is_required_type as is_required_type,
|
41
41
|
is_annotated_type as is_annotated_type,
|
42
|
+
is_type_alias_type as is_type_alias_type,
|
42
43
|
strip_annotated_type as strip_annotated_type,
|
43
44
|
extract_type_var_from_base as extract_type_var_from_base,
|
44
45
|
)
|
runwayml/_utils/_typing.py
CHANGED
@@ -1,8 +1,17 @@
|
|
1
1
|
from __future__ import annotations
|
2
2
|
|
3
|
+
import sys
|
4
|
+
import typing
|
5
|
+
import typing_extensions
|
3
6
|
from typing import Any, TypeVar, Iterable, cast
|
4
7
|
from collections import abc as _c_abc
|
5
|
-
from typing_extensions import
|
8
|
+
from typing_extensions import (
|
9
|
+
TypeIs,
|
10
|
+
Required,
|
11
|
+
Annotated,
|
12
|
+
get_args,
|
13
|
+
get_origin,
|
14
|
+
)
|
6
15
|
|
7
16
|
from .._types import InheritsGeneric
|
8
17
|
from .._compat import is_union as _is_union
|
@@ -36,6 +45,26 @@ def is_typevar(typ: type) -> bool:
|
|
36
45
|
return type(typ) == TypeVar # type: ignore
|
37
46
|
|
38
47
|
|
48
|
+
_TYPE_ALIAS_TYPES: tuple[type[typing_extensions.TypeAliasType], ...] = (typing_extensions.TypeAliasType,)
|
49
|
+
if sys.version_info >= (3, 12):
|
50
|
+
_TYPE_ALIAS_TYPES = (*_TYPE_ALIAS_TYPES, typing.TypeAliasType)
|
51
|
+
|
52
|
+
|
53
|
+
def is_type_alias_type(tp: Any, /) -> TypeIs[typing_extensions.TypeAliasType]:
|
54
|
+
"""Return whether the provided argument is an instance of `TypeAliasType`.
|
55
|
+
|
56
|
+
```python
|
57
|
+
type Int = int
|
58
|
+
is_type_alias_type(Int)
|
59
|
+
# > True
|
60
|
+
Str = TypeAliasType("Str", str)
|
61
|
+
is_type_alias_type(Str)
|
62
|
+
# > True
|
63
|
+
```
|
64
|
+
"""
|
65
|
+
return isinstance(tp, _TYPE_ALIAS_TYPES)
|
66
|
+
|
67
|
+
|
39
68
|
# Extracts T from Annotated[T, ...] or from Required[Annotated[T, ...]]
|
40
69
|
def strip_annotated_type(typ: type) -> type:
|
41
70
|
if is_required_type(typ) or is_annotated_type(typ):
|
runwayml/_version.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: runwayml
|
3
|
-
Version: 2.1.
|
3
|
+
Version: 2.1.5
|
4
4
|
Summary: The official Python library for the runwayml API
|
5
5
|
Project-URL: Homepage, https://github.com/runwayml/sdk-python
|
6
6
|
Project-URL: Repository, https://github.com/runwayml/sdk-python
|
@@ -26,7 +26,7 @@ Requires-Dist: distro<2,>=1.7.0
|
|
26
26
|
Requires-Dist: httpx<1,>=0.23.0
|
27
27
|
Requires-Dist: pydantic<3,>=1.9.0
|
28
28
|
Requires-Dist: sniffio
|
29
|
-
Requires-Dist: typing-extensions<5,>=4.
|
29
|
+
Requires-Dist: typing-extensions<5,>=4.10
|
30
30
|
Description-Content-Type: text/markdown
|
31
31
|
|
32
32
|
# RunwayML Python API library
|
@@ -5,22 +5,22 @@ runwayml/_compat.py,sha256=VWemUKbj6DDkQ-O4baSpHVLJafotzeXmCQGJugfVTIw,6580
|
|
5
5
|
runwayml/_constants.py,sha256=JE8kyZa2Q4NK_i4fO--8siEYTzeHnT0fYbOFDgDP4uk,464
|
6
6
|
runwayml/_exceptions.py,sha256=p2Q8kywHCVQzArLQL4Ht-HetTBhAvevU6yDvEq7PpIE,3224
|
7
7
|
runwayml/_files.py,sha256=mf4dOgL4b0ryyZlbqLhggD3GVgDf6XxdGFAgce01ugE,3549
|
8
|
-
runwayml/_models.py,sha256=
|
8
|
+
runwayml/_models.py,sha256=iumFIitiWZTGITgF2nwOmEPIJGIEeJaUXhDlpaSN9Wg,28589
|
9
9
|
runwayml/_qs.py,sha256=AOkSz4rHtK4YI3ZU_kzea-zpwBUgEY8WniGmTPyEimc,4846
|
10
10
|
runwayml/_resource.py,sha256=BF-j3xY5eRTKmuTxg8eDhLtLP4MLB1phDh_B6BKipKA,1112
|
11
|
-
runwayml/_response.py,sha256=
|
11
|
+
runwayml/_response.py,sha256=RetJb-IkgnyakTwxVpNoHS4r6gR-fWncQ1z-t_E4x1A,28677
|
12
12
|
runwayml/_streaming.py,sha256=NSVuAgknVQWU1cgZEjQn01IdZKKynb5rOeYp5Lo-OEQ,10108
|
13
13
|
runwayml/_types.py,sha256=oHct1QQY_lI8bepCgfWDZm2N5VNi0e6o1iLeiTh4Y_0,6145
|
14
|
-
runwayml/_version.py,sha256
|
14
|
+
runwayml/_version.py,sha256=_1fJEWE_WpuqcDAZHCQG3FQtSUMBHUbE-hIU6-JiyEk,160
|
15
15
|
runwayml/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
16
|
-
runwayml/_utils/__init__.py,sha256=
|
16
|
+
runwayml/_utils/__init__.py,sha256=PNZ_QJuzZEgyYXqkO1HVhGkj5IU9bglVUcw7H-Knjzw,2062
|
17
17
|
runwayml/_utils/_logs.py,sha256=ZfS5W59hdqEBVV86lNrk28PhvUxtHOzs9JqiLhSu0pI,780
|
18
18
|
runwayml/_utils/_proxy.py,sha256=z3zsateHtb0EARTWKk8QZNHfPkqJbqwd1lM993LBwGE,1902
|
19
19
|
runwayml/_utils/_reflection.py,sha256=ZmGkIgT_PuwedyNBrrKGbxoWtkpytJNU1uU4QHnmEMU,1364
|
20
20
|
runwayml/_utils/_streams.py,sha256=SMC90diFFecpEg_zgDRVbdR3hSEIgVVij4taD-noMLM,289
|
21
21
|
runwayml/_utils/_sync.py,sha256=jJl-iCEaZZUAkq4IUtzN1-aMsKTUFaNoNbeYnnpQjIQ,2438
|
22
22
|
runwayml/_utils/_transform.py,sha256=Dkkyr7OveGmOolepcvXmVJWE3kqim4b0nM0h7yWbgeY,13468
|
23
|
-
runwayml/_utils/_typing.py,sha256=
|
23
|
+
runwayml/_utils/_typing.py,sha256=nTJz0jcrQbEgxwy4TtAkNxuU0QHHlmc6mQtA6vIR8tg,4501
|
24
24
|
runwayml/_utils/_utils.py,sha256=8UmbPOy_AAr2uUjjFui-VZSrVBHRj6bfNEKRp5YZP2A,12004
|
25
25
|
runwayml/lib/.keep,sha256=wuNrz-5SXo3jJaJOJgz4vFHM41YH_g20F5cRQo0vLes,224
|
26
26
|
runwayml/resources/__init__.py,sha256=O-ZVFaODsGXK0pKVlV4HKoeJyq3p9sK_9COJTv7P1WM,1069
|
@@ -30,7 +30,7 @@ runwayml/types/__init__.py,sha256=R3cLEXzpcEpEOuxaFBo3R72ewH1LtjpkZ0aYOIt1CAo,40
|
|
30
30
|
runwayml/types/image_to_video_create_params.py,sha256=98DsjOHnmHEi8mVjZOQEDL3P1hJUT8uktp0mDA5WJ5Y,1869
|
31
31
|
runwayml/types/image_to_video_create_response.py,sha256=l5GszzUSItV-ZYHCB8hH_GSVibUZEkzfRLrAhXkd8O4,346
|
32
32
|
runwayml/types/task_retrieve_response.py,sha256=v8y2bLxsW6srzScW-B3Akv72q_PI_NQmduGrGRQMHds,2139
|
33
|
-
runwayml-2.1.
|
34
|
-
runwayml-2.1.
|
35
|
-
runwayml-2.1.
|
36
|
-
runwayml-2.1.
|
33
|
+
runwayml-2.1.5.dist-info/METADATA,sha256=P4u1dRt5dmrIagQ4CAwqqhBRBFztVUo5dWZyjNh9U7c,13418
|
34
|
+
runwayml-2.1.5.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
|
35
|
+
runwayml-2.1.5.dist-info/licenses/LICENSE,sha256=p4nykVRdA5nXTd8-slKCIfrlJZMB3wn8QBVasNQ_G_Q,11338
|
36
|
+
runwayml-2.1.5.dist-info/RECORD,,
|
File without changes
|
File without changes
|