runwayml 3.0.0__py3-none-any.whl → 3.0.1__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/_base_client.py CHANGED
@@ -409,7 +409,8 @@ class BaseClient(Generic[_HttpxClientT, _DefaultStreamT]):
409
409
 
410
410
  idempotency_header = self._idempotency_header
411
411
  if idempotency_header and options.method.lower() != "get" and idempotency_header not in headers:
412
- headers[idempotency_header] = options.idempotency_key or self._idempotency_key()
412
+ options.idempotency_key = options.idempotency_key or self._idempotency_key()
413
+ headers[idempotency_header] = options.idempotency_key
413
414
 
414
415
  # Don't set these headers if they were already set or removed by the caller. We check
415
416
  # `custom_headers`, which can contain `Omit()`, instead of `headers` to account for the removal case.
@@ -943,6 +944,10 @@ class SyncAPIClient(BaseClient[httpx.Client, Stream[Any]]):
943
944
  request = self._build_request(options, retries_taken=retries_taken)
944
945
  self._prepare_request(request)
945
946
 
947
+ if options.idempotency_key:
948
+ # ensure the idempotency key is reused between requests
949
+ input_options.idempotency_key = options.idempotency_key
950
+
946
951
  kwargs: HttpxSendArgs = {}
947
952
  if self.custom_auth is not None:
948
953
  kwargs["auth"] = self.custom_auth
@@ -1475,6 +1480,10 @@ class AsyncAPIClient(BaseClient[httpx.AsyncClient, AsyncStream[Any]]):
1475
1480
  request = self._build_request(options, retries_taken=retries_taken)
1476
1481
  await self._prepare_request(request)
1477
1482
 
1483
+ if options.idempotency_key:
1484
+ # ensure the idempotency key is reused between requests
1485
+ input_options.idempotency_key = options.idempotency_key
1486
+
1478
1487
  kwargs: HttpxSendArgs = {}
1479
1488
  if self.custom_auth is not None:
1480
1489
  kwargs["auth"] = self.custom_auth
@@ -5,13 +5,15 @@ import base64
5
5
  import pathlib
6
6
  from typing import Any, Mapping, TypeVar, cast
7
7
  from datetime import date, datetime
8
- from typing_extensions import Literal, get_args, override, get_type_hints
8
+ from typing_extensions import Literal, get_args, override, get_type_hints as _get_type_hints
9
9
 
10
10
  import anyio
11
11
  import pydantic
12
12
 
13
13
  from ._utils import (
14
14
  is_list,
15
+ is_given,
16
+ lru_cache,
15
17
  is_mapping,
16
18
  is_iterable,
17
19
  )
@@ -108,6 +110,7 @@ def transform(
108
110
  return cast(_T, transformed)
109
111
 
110
112
 
113
+ @lru_cache(maxsize=8096)
111
114
  def _get_annotated_type(type_: type) -> type | None:
112
115
  """If the given type is an `Annotated` type then it is returned, if not `None` is returned.
113
116
 
@@ -258,6 +261,11 @@ def _transform_typeddict(
258
261
  result: dict[str, object] = {}
259
262
  annotations = get_type_hints(expected_type, include_extras=True)
260
263
  for key, value in data.items():
264
+ if not is_given(value):
265
+ # we don't need to include `NotGiven` values here as they'll
266
+ # be stripped out before the request is sent anyway
267
+ continue
268
+
261
269
  type_ = annotations.get(key)
262
270
  if type_ is None:
263
271
  # we do not have a type annotation for this field, leave it as is
@@ -415,6 +423,11 @@ async def _async_transform_typeddict(
415
423
  result: dict[str, object] = {}
416
424
  annotations = get_type_hints(expected_type, include_extras=True)
417
425
  for key, value in data.items():
426
+ if not is_given(value):
427
+ # we don't need to include `NotGiven` values here as they'll
428
+ # be stripped out before the request is sent anyway
429
+ continue
430
+
418
431
  type_ = annotations.get(key)
419
432
  if type_ is None:
420
433
  # we do not have a type annotation for this field, leave it as is
@@ -422,3 +435,13 @@ async def _async_transform_typeddict(
422
435
  else:
423
436
  result[_maybe_transform_key(key, type_)] = await _async_transform_recursive(value, annotation=type_)
424
437
  return result
438
+
439
+
440
+ @lru_cache(maxsize=8096)
441
+ def get_type_hints(
442
+ obj: Any,
443
+ globalns: dict[str, Any] | None = None,
444
+ localns: Mapping[str, Any] | None = None,
445
+ include_extras: bool = False,
446
+ ) -> dict[str, Any]:
447
+ return _get_type_hints(obj, globalns=globalns, localns=localns, include_extras=include_extras)
@@ -13,6 +13,7 @@ from typing_extensions import (
13
13
  get_origin,
14
14
  )
15
15
 
16
+ from ._utils import lru_cache
16
17
  from .._types import InheritsGeneric
17
18
  from .._compat import is_union as _is_union
18
19
 
@@ -66,6 +67,7 @@ def is_type_alias_type(tp: Any, /) -> TypeIs[typing_extensions.TypeAliasType]:
66
67
 
67
68
 
68
69
  # Extracts T from Annotated[T, ...] or from Required[Annotated[T, ...]]
70
+ @lru_cache(maxsize=8096)
69
71
  def strip_annotated_type(typ: type) -> type:
70
72
  if is_required_type(typ) or is_annotated_type(typ):
71
73
  return strip_annotated_type(cast(type, get_args(typ)[0]))
runwayml/_version.py CHANGED
@@ -1,4 +1,4 @@
1
1
  # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  __title__ = "runwayml"
4
- __version__ = "3.0.0" # x-release-please-version
4
+ __version__ = "3.0.1" # x-release-please-version
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: runwayml
3
- Version: 3.0.0
3
+ Version: 3.0.1
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
@@ -1,5 +1,5 @@
1
1
  runwayml/__init__.py,sha256=iXnJfH73wbj9IxfCHpwfWBxgOa9C4FRrrbBZM5f3biw,2476
2
- runwayml/_base_client.py,sha256=qT2Gv0eeU7rPXdd6I4Kf64KGe8oUm5qsthI-khYDBCA,64959
2
+ runwayml/_base_client.py,sha256=BY_2p5vumkAeyhc7M3PjWeX9IlxfaDu1HIOSPDmT4X0,65367
3
3
  runwayml/_client.py,sha256=oUOh2gdY1YtVefv51GTssitaCuDQIncvVlxTvzDJyec,17136
4
4
  runwayml/_compat.py,sha256=VWemUKbj6DDkQ-O4baSpHVLJafotzeXmCQGJugfVTIw,6580
5
5
  runwayml/_constants.py,sha256=S14PFzyN9-I31wiV7SmIlL5Ga0MLHxdvegInGdXH7tM,462
@@ -11,7 +11,7 @@ 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=_UUv2TBwv2bsX7GOIpHXIrUMZ7qQKyoAuNf69zwd4iQ,160
14
+ runwayml/_version.py,sha256=CPiXNPVxUqxftw-dZ-WnMk2SLbX6jS2ERS5um080dS8,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
@@ -19,8 +19,8 @@ runwayml/_utils/_proxy.py,sha256=z3zsateHtb0EARTWKk8QZNHfPkqJbqwd1lM993LBwGE,190
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=TpGLrrhRNWTJtODNE6Fup3_k7zrWm1j2RlirzBwre-0,2862
22
- runwayml/_utils/_transform.py,sha256=xfcRTFidCyPhQ7hXeivxpAS0x-NhTyr20iXm1cKcJYk,14857
23
- runwayml/_utils/_typing.py,sha256=nTJz0jcrQbEgxwy4TtAkNxuU0QHHlmc6mQtA6vIR8tg,4501
22
+ runwayml/_utils/_transform.py,sha256=n7kskEWz6o__aoNvhFoGVyDoalNe6mJwp-g7BWkdj88,15617
23
+ runwayml/_utils/_typing.py,sha256=nOFiIH5faG-h5Ha-Ky2aZxw5kmR6iX8KzNtsn3JEWoA,4556
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=SqcC1MLwxPaz2c7gRRBlOn9-2pDPMKTXD2gFbG5FJ2E,1597
@@ -32,7 +32,7 @@ runwayml/types/image_to_video_create_params.py,sha256=VNWGDEdqkhp-Br-19t8YYfaYMa
32
32
  runwayml/types/image_to_video_create_response.py,sha256=l5GszzUSItV-ZYHCB8hH_GSVibUZEkzfRLrAhXkd8O4,346
33
33
  runwayml/types/organization_retrieve_response.py,sha256=DV46yEIRjmL05uISc2-PpM5BGWu8gniA9TQ056abWLA,2721
34
34
  runwayml/types/task_retrieve_response.py,sha256=v8y2bLxsW6srzScW-B3Akv72q_PI_NQmduGrGRQMHds,2139
35
- runwayml-3.0.0.dist-info/METADATA,sha256=kJq3rjQuJDsIjk83NOxFZt3t3BpKcQP1Tqzq2tP39Yw,13516
36
- runwayml-3.0.0.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
37
- runwayml-3.0.0.dist-info/licenses/LICENSE,sha256=baeFj6izBWIm6A5_7N3-WAsy_VYpDF05Dd4zS1zsfZI,11338
38
- runwayml-3.0.0.dist-info/RECORD,,
35
+ runwayml-3.0.1.dist-info/METADATA,sha256=1fj9_9szjNroqdi0Dsw0HuaswObIWDdLx8Avngy3trI,13516
36
+ runwayml-3.0.1.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
37
+ runwayml-3.0.1.dist-info/licenses/LICENSE,sha256=baeFj6izBWIm6A5_7N3-WAsy_VYpDF05Dd4zS1zsfZI,11338
38
+ runwayml-3.0.1.dist-info/RECORD,,