runwayml 2.2.1__py3-none-any.whl → 2.2.2__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/_utils/_sync.py +17 -2
- runwayml/_version.py +1 -1
- {runwayml-2.2.1.dist-info → runwayml-2.2.2.dist-info}/METADATA +1 -1
- {runwayml-2.2.1.dist-info → runwayml-2.2.2.dist-info}/RECORD +6 -6
- {runwayml-2.2.1.dist-info → runwayml-2.2.2.dist-info}/WHEEL +0 -0
- {runwayml-2.2.1.dist-info → runwayml-2.2.2.dist-info}/licenses/LICENSE +0 -0
runwayml/_utils/_sync.py
CHANGED
@@ -7,16 +7,20 @@ import contextvars
|
|
7
7
|
from typing import Any, TypeVar, Callable, Awaitable
|
8
8
|
from typing_extensions import ParamSpec
|
9
9
|
|
10
|
+
import anyio
|
11
|
+
import sniffio
|
12
|
+
import anyio.to_thread
|
13
|
+
|
10
14
|
T_Retval = TypeVar("T_Retval")
|
11
15
|
T_ParamSpec = ParamSpec("T_ParamSpec")
|
12
16
|
|
13
17
|
|
14
18
|
if sys.version_info >= (3, 9):
|
15
|
-
|
19
|
+
_asyncio_to_thread = asyncio.to_thread
|
16
20
|
else:
|
17
21
|
# backport of https://docs.python.org/3/library/asyncio-task.html#asyncio.to_thread
|
18
22
|
# for Python 3.8 support
|
19
|
-
async def
|
23
|
+
async def _asyncio_to_thread(
|
20
24
|
func: Callable[T_ParamSpec, T_Retval], /, *args: T_ParamSpec.args, **kwargs: T_ParamSpec.kwargs
|
21
25
|
) -> Any:
|
22
26
|
"""Asynchronously run function *func* in a separate thread.
|
@@ -34,6 +38,17 @@ else:
|
|
34
38
|
return await loop.run_in_executor(None, func_call)
|
35
39
|
|
36
40
|
|
41
|
+
async def to_thread(
|
42
|
+
func: Callable[T_ParamSpec, T_Retval], /, *args: T_ParamSpec.args, **kwargs: T_ParamSpec.kwargs
|
43
|
+
) -> T_Retval:
|
44
|
+
if sniffio.current_async_library() == "asyncio":
|
45
|
+
return await _asyncio_to_thread(func, *args, **kwargs)
|
46
|
+
|
47
|
+
return await anyio.to_thread.run_sync(
|
48
|
+
functools.partial(func, *args, **kwargs),
|
49
|
+
)
|
50
|
+
|
51
|
+
|
37
52
|
# inspired by `asyncer`, https://github.com/tiangolo/asyncer
|
38
53
|
def asyncify(function: Callable[T_ParamSpec, T_Retval]) -> Callable[T_ParamSpec, Awaitable[T_Retval]]:
|
39
54
|
"""
|
runwayml/_version.py
CHANGED
@@ -11,14 +11,14 @@ runwayml/_resource.py,sha256=BF-j3xY5eRTKmuTxg8eDhLtLP4MLB1phDh_B6BKipKA,1112
|
|
11
11
|
runwayml/_response.py,sha256=3Tf7pmDYDMv5BJuF0ljEBtMMk5Q9T7jcWn7I6P-hbdM,28801
|
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=ekUU34LiRRIAS3QI35Jod80voCQNRlraSOOkmacoP6Y,160
|
15
15
|
runwayml/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
16
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
|
-
runwayml/_utils/_sync.py,sha256=
|
21
|
+
runwayml/_utils/_sync.py,sha256=TpGLrrhRNWTJtODNE6Fup3_k7zrWm1j2RlirzBwre-0,2862
|
22
22
|
runwayml/_utils/_transform.py,sha256=tsSFOIZ7iczaUsMSGBD_iSFOOdUyT2xtkcq1xyF0L9o,13986
|
23
23
|
runwayml/_utils/_typing.py,sha256=nTJz0jcrQbEgxwy4TtAkNxuU0QHHlmc6mQtA6vIR8tg,4501
|
24
24
|
runwayml/_utils/_utils.py,sha256=8UmbPOy_AAr2uUjjFui-VZSrVBHRj6bfNEKRp5YZP2A,12004
|
@@ -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.2.
|
34
|
-
runwayml-2.2.
|
35
|
-
runwayml-2.2.
|
36
|
-
runwayml-2.2.
|
33
|
+
runwayml-2.2.2.dist-info/METADATA,sha256=rqzi5U4PEg_Lhwk-W-UlQoL0H1WlNs7F11PahFiTO4s,13559
|
34
|
+
runwayml-2.2.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
35
|
+
runwayml-2.2.2.dist-info/licenses/LICENSE,sha256=baeFj6izBWIm6A5_7N3-WAsy_VYpDF05Dd4zS1zsfZI,11338
|
36
|
+
runwayml-2.2.2.dist-info/RECORD,,
|
File without changes
|
File without changes
|