runwayml 1.0.0__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/_client.py ADDED
@@ -0,0 +1,432 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ import os
6
+ from typing import Any, Union, Mapping
7
+ from typing_extensions import Self, override
8
+
9
+ import httpx
10
+
11
+ from . import resources, _exceptions
12
+ from ._qs import Querystring
13
+ from ._types import (
14
+ NOT_GIVEN,
15
+ Omit,
16
+ Timeout,
17
+ NotGiven,
18
+ Transport,
19
+ ProxiesTypes,
20
+ RequestOptions,
21
+ )
22
+ from ._utils import (
23
+ is_given,
24
+ get_async_library,
25
+ )
26
+ from ._version import __version__
27
+ from ._streaming import Stream as Stream, AsyncStream as AsyncStream
28
+ from ._exceptions import RunwayMLError, APIStatusError
29
+ from ._base_client import (
30
+ DEFAULT_MAX_RETRIES,
31
+ SyncAPIClient,
32
+ AsyncAPIClient,
33
+ )
34
+
35
+ __all__ = [
36
+ "Timeout",
37
+ "Transport",
38
+ "ProxiesTypes",
39
+ "RequestOptions",
40
+ "resources",
41
+ "RunwayML",
42
+ "AsyncRunwayML",
43
+ "Client",
44
+ "AsyncClient",
45
+ ]
46
+
47
+
48
+ class RunwayML(SyncAPIClient):
49
+ tasks: resources.TasksResource
50
+ image_to_video: resources.ImageToVideoResource
51
+ with_raw_response: RunwayMLWithRawResponse
52
+ with_streaming_response: RunwayMLWithStreamedResponse
53
+
54
+ # client options
55
+ api_key: str
56
+ runway_version: str
57
+
58
+ def __init__(
59
+ self,
60
+ *,
61
+ api_key: str | None = None,
62
+ runway_version: str | None = "2024-09-13",
63
+ base_url: str | httpx.URL | None = None,
64
+ timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN,
65
+ max_retries: int = DEFAULT_MAX_RETRIES,
66
+ default_headers: Mapping[str, str] | None = None,
67
+ default_query: Mapping[str, object] | None = None,
68
+ # Configure a custom httpx client.
69
+ # We provide a `DefaultHttpxClient` class that you can pass to retain the default values we use for `limits`, `timeout` & `follow_redirects`.
70
+ # See the [httpx documentation](https://www.python-httpx.org/api/#client) for more details.
71
+ http_client: httpx.Client | None = None,
72
+ # Enable or disable schema validation for data returned by the API.
73
+ # When enabled an error APIResponseValidationError is raised
74
+ # if the API responds with invalid data for the expected schema.
75
+ #
76
+ # This parameter may be removed or changed in the future.
77
+ # If you rely on this feature, please open a GitHub issue
78
+ # outlining your use-case to help us decide if it should be
79
+ # part of our public interface in the future.
80
+ _strict_response_validation: bool = False,
81
+ ) -> None:
82
+ """Construct a new synchronous runwayml client instance.
83
+
84
+ This automatically infers the `api_key` argument from the `RUNWAYML_API_SECRET` environment variable if it is not provided.
85
+ """
86
+ if api_key is None:
87
+ api_key = os.environ.get("RUNWAYML_API_SECRET")
88
+ if api_key is None:
89
+ raise RunwayMLError(
90
+ "The api_key client option must be set either by passing api_key to the client or by setting the RUNWAYML_API_SECRET environment variable"
91
+ )
92
+ self.api_key = api_key
93
+
94
+ if runway_version is None:
95
+ runway_version = "2024-09-13"
96
+ self.runway_version = runway_version
97
+
98
+ if base_url is None:
99
+ base_url = os.environ.get("RUNWAYML_BASE_URL")
100
+ if base_url is None:
101
+ base_url = f"https://api.dev.runwayml.com"
102
+
103
+ super().__init__(
104
+ version=__version__,
105
+ base_url=base_url,
106
+ max_retries=max_retries,
107
+ timeout=timeout,
108
+ http_client=http_client,
109
+ custom_headers=default_headers,
110
+ custom_query=default_query,
111
+ _strict_response_validation=_strict_response_validation,
112
+ )
113
+
114
+ self.tasks = resources.TasksResource(self)
115
+ self.image_to_video = resources.ImageToVideoResource(self)
116
+ self.with_raw_response = RunwayMLWithRawResponse(self)
117
+ self.with_streaming_response = RunwayMLWithStreamedResponse(self)
118
+
119
+ @property
120
+ @override
121
+ def qs(self) -> Querystring:
122
+ return Querystring(array_format="comma")
123
+
124
+ @property
125
+ @override
126
+ def auth_headers(self) -> dict[str, str]:
127
+ api_key = self.api_key
128
+ return {"Authorization": f"Bearer {api_key}"}
129
+
130
+ @property
131
+ @override
132
+ def default_headers(self) -> dict[str, str | Omit]:
133
+ return {
134
+ **super().default_headers,
135
+ "X-Stainless-Async": "false",
136
+ "X-Runway-Version": self.runway_version,
137
+ **self._custom_headers,
138
+ }
139
+
140
+ def copy(
141
+ self,
142
+ *,
143
+ api_key: str | None = None,
144
+ runway_version: str | None = None,
145
+ base_url: str | httpx.URL | None = None,
146
+ timeout: float | Timeout | None | NotGiven = NOT_GIVEN,
147
+ http_client: httpx.Client | None = None,
148
+ max_retries: int | NotGiven = NOT_GIVEN,
149
+ default_headers: Mapping[str, str] | None = None,
150
+ set_default_headers: Mapping[str, str] | None = None,
151
+ default_query: Mapping[str, object] | None = None,
152
+ set_default_query: Mapping[str, object] | None = None,
153
+ _extra_kwargs: Mapping[str, Any] = {},
154
+ ) -> Self:
155
+ """
156
+ Create a new client instance re-using the same options given to the current client with optional overriding.
157
+ """
158
+ if default_headers is not None and set_default_headers is not None:
159
+ raise ValueError("The `default_headers` and `set_default_headers` arguments are mutually exclusive")
160
+
161
+ if default_query is not None and set_default_query is not None:
162
+ raise ValueError("The `default_query` and `set_default_query` arguments are mutually exclusive")
163
+
164
+ headers = self._custom_headers
165
+ if default_headers is not None:
166
+ headers = {**headers, **default_headers}
167
+ elif set_default_headers is not None:
168
+ headers = set_default_headers
169
+
170
+ params = self._custom_query
171
+ if default_query is not None:
172
+ params = {**params, **default_query}
173
+ elif set_default_query is not None:
174
+ params = set_default_query
175
+
176
+ http_client = http_client or self._client
177
+ return self.__class__(
178
+ api_key=api_key or self.api_key,
179
+ runway_version=runway_version or self.runway_version,
180
+ base_url=base_url or self.base_url,
181
+ timeout=self.timeout if isinstance(timeout, NotGiven) else timeout,
182
+ http_client=http_client,
183
+ max_retries=max_retries if is_given(max_retries) else self.max_retries,
184
+ default_headers=headers,
185
+ default_query=params,
186
+ **_extra_kwargs,
187
+ )
188
+
189
+ # Alias for `copy` for nicer inline usage, e.g.
190
+ # client.with_options(timeout=10).foo.create(...)
191
+ with_options = copy
192
+
193
+ @override
194
+ def _make_status_error(
195
+ self,
196
+ err_msg: str,
197
+ *,
198
+ body: object,
199
+ response: httpx.Response,
200
+ ) -> APIStatusError:
201
+ if response.status_code == 400:
202
+ return _exceptions.BadRequestError(err_msg, response=response, body=body)
203
+
204
+ if response.status_code == 401:
205
+ return _exceptions.AuthenticationError(err_msg, response=response, body=body)
206
+
207
+ if response.status_code == 403:
208
+ return _exceptions.PermissionDeniedError(err_msg, response=response, body=body)
209
+
210
+ if response.status_code == 404:
211
+ return _exceptions.NotFoundError(err_msg, response=response, body=body)
212
+
213
+ if response.status_code == 409:
214
+ return _exceptions.ConflictError(err_msg, response=response, body=body)
215
+
216
+ if response.status_code == 422:
217
+ return _exceptions.UnprocessableEntityError(err_msg, response=response, body=body)
218
+
219
+ if response.status_code == 429:
220
+ return _exceptions.RateLimitError(err_msg, response=response, body=body)
221
+
222
+ if response.status_code >= 500:
223
+ return _exceptions.InternalServerError(err_msg, response=response, body=body)
224
+ return APIStatusError(err_msg, response=response, body=body)
225
+
226
+
227
+ class AsyncRunwayML(AsyncAPIClient):
228
+ tasks: resources.AsyncTasksResource
229
+ image_to_video: resources.AsyncImageToVideoResource
230
+ with_raw_response: AsyncRunwayMLWithRawResponse
231
+ with_streaming_response: AsyncRunwayMLWithStreamedResponse
232
+
233
+ # client options
234
+ api_key: str
235
+ runway_version: str
236
+
237
+ def __init__(
238
+ self,
239
+ *,
240
+ api_key: str | None = None,
241
+ runway_version: str | None = "2024-09-13",
242
+ base_url: str | httpx.URL | None = None,
243
+ timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN,
244
+ max_retries: int = DEFAULT_MAX_RETRIES,
245
+ default_headers: Mapping[str, str] | None = None,
246
+ default_query: Mapping[str, object] | None = None,
247
+ # Configure a custom httpx client.
248
+ # We provide a `DefaultAsyncHttpxClient` class that you can pass to retain the default values we use for `limits`, `timeout` & `follow_redirects`.
249
+ # See the [httpx documentation](https://www.python-httpx.org/api/#asyncclient) for more details.
250
+ http_client: httpx.AsyncClient | None = None,
251
+ # Enable or disable schema validation for data returned by the API.
252
+ # When enabled an error APIResponseValidationError is raised
253
+ # if the API responds with invalid data for the expected schema.
254
+ #
255
+ # This parameter may be removed or changed in the future.
256
+ # If you rely on this feature, please open a GitHub issue
257
+ # outlining your use-case to help us decide if it should be
258
+ # part of our public interface in the future.
259
+ _strict_response_validation: bool = False,
260
+ ) -> None:
261
+ """Construct a new async runwayml client instance.
262
+
263
+ This automatically infers the `api_key` argument from the `RUNWAYML_API_SECRET` environment variable if it is not provided.
264
+ """
265
+ if api_key is None:
266
+ api_key = os.environ.get("RUNWAYML_API_SECRET")
267
+ if api_key is None:
268
+ raise RunwayMLError(
269
+ "The api_key client option must be set either by passing api_key to the client or by setting the RUNWAYML_API_SECRET environment variable"
270
+ )
271
+ self.api_key = api_key
272
+
273
+ if runway_version is None:
274
+ runway_version = "2024-09-13"
275
+ self.runway_version = runway_version
276
+
277
+ if base_url is None:
278
+ base_url = os.environ.get("RUNWAYML_BASE_URL")
279
+ if base_url is None:
280
+ base_url = f"https://api.dev.runwayml.com"
281
+
282
+ super().__init__(
283
+ version=__version__,
284
+ base_url=base_url,
285
+ max_retries=max_retries,
286
+ timeout=timeout,
287
+ http_client=http_client,
288
+ custom_headers=default_headers,
289
+ custom_query=default_query,
290
+ _strict_response_validation=_strict_response_validation,
291
+ )
292
+
293
+ self.tasks = resources.AsyncTasksResource(self)
294
+ self.image_to_video = resources.AsyncImageToVideoResource(self)
295
+ self.with_raw_response = AsyncRunwayMLWithRawResponse(self)
296
+ self.with_streaming_response = AsyncRunwayMLWithStreamedResponse(self)
297
+
298
+ @property
299
+ @override
300
+ def qs(self) -> Querystring:
301
+ return Querystring(array_format="comma")
302
+
303
+ @property
304
+ @override
305
+ def auth_headers(self) -> dict[str, str]:
306
+ api_key = self.api_key
307
+ return {"Authorization": f"Bearer {api_key}"}
308
+
309
+ @property
310
+ @override
311
+ def default_headers(self) -> dict[str, str | Omit]:
312
+ return {
313
+ **super().default_headers,
314
+ "X-Stainless-Async": f"async:{get_async_library()}",
315
+ "X-Runway-Version": self.runway_version,
316
+ **self._custom_headers,
317
+ }
318
+
319
+ def copy(
320
+ self,
321
+ *,
322
+ api_key: str | None = None,
323
+ runway_version: str | None = None,
324
+ base_url: str | httpx.URL | None = None,
325
+ timeout: float | Timeout | None | NotGiven = NOT_GIVEN,
326
+ http_client: httpx.AsyncClient | None = None,
327
+ max_retries: int | NotGiven = NOT_GIVEN,
328
+ default_headers: Mapping[str, str] | None = None,
329
+ set_default_headers: Mapping[str, str] | None = None,
330
+ default_query: Mapping[str, object] | None = None,
331
+ set_default_query: Mapping[str, object] | None = None,
332
+ _extra_kwargs: Mapping[str, Any] = {},
333
+ ) -> Self:
334
+ """
335
+ Create a new client instance re-using the same options given to the current client with optional overriding.
336
+ """
337
+ if default_headers is not None and set_default_headers is not None:
338
+ raise ValueError("The `default_headers` and `set_default_headers` arguments are mutually exclusive")
339
+
340
+ if default_query is not None and set_default_query is not None:
341
+ raise ValueError("The `default_query` and `set_default_query` arguments are mutually exclusive")
342
+
343
+ headers = self._custom_headers
344
+ if default_headers is not None:
345
+ headers = {**headers, **default_headers}
346
+ elif set_default_headers is not None:
347
+ headers = set_default_headers
348
+
349
+ params = self._custom_query
350
+ if default_query is not None:
351
+ params = {**params, **default_query}
352
+ elif set_default_query is not None:
353
+ params = set_default_query
354
+
355
+ http_client = http_client or self._client
356
+ return self.__class__(
357
+ api_key=api_key or self.api_key,
358
+ runway_version=runway_version or self.runway_version,
359
+ base_url=base_url or self.base_url,
360
+ timeout=self.timeout if isinstance(timeout, NotGiven) else timeout,
361
+ http_client=http_client,
362
+ max_retries=max_retries if is_given(max_retries) else self.max_retries,
363
+ default_headers=headers,
364
+ default_query=params,
365
+ **_extra_kwargs,
366
+ )
367
+
368
+ # Alias for `copy` for nicer inline usage, e.g.
369
+ # client.with_options(timeout=10).foo.create(...)
370
+ with_options = copy
371
+
372
+ @override
373
+ def _make_status_error(
374
+ self,
375
+ err_msg: str,
376
+ *,
377
+ body: object,
378
+ response: httpx.Response,
379
+ ) -> APIStatusError:
380
+ if response.status_code == 400:
381
+ return _exceptions.BadRequestError(err_msg, response=response, body=body)
382
+
383
+ if response.status_code == 401:
384
+ return _exceptions.AuthenticationError(err_msg, response=response, body=body)
385
+
386
+ if response.status_code == 403:
387
+ return _exceptions.PermissionDeniedError(err_msg, response=response, body=body)
388
+
389
+ if response.status_code == 404:
390
+ return _exceptions.NotFoundError(err_msg, response=response, body=body)
391
+
392
+ if response.status_code == 409:
393
+ return _exceptions.ConflictError(err_msg, response=response, body=body)
394
+
395
+ if response.status_code == 422:
396
+ return _exceptions.UnprocessableEntityError(err_msg, response=response, body=body)
397
+
398
+ if response.status_code == 429:
399
+ return _exceptions.RateLimitError(err_msg, response=response, body=body)
400
+
401
+ if response.status_code >= 500:
402
+ return _exceptions.InternalServerError(err_msg, response=response, body=body)
403
+ return APIStatusError(err_msg, response=response, body=body)
404
+
405
+
406
+ class RunwayMLWithRawResponse:
407
+ def __init__(self, client: RunwayML) -> None:
408
+ self.tasks = resources.TasksResourceWithRawResponse(client.tasks)
409
+ self.image_to_video = resources.ImageToVideoResourceWithRawResponse(client.image_to_video)
410
+
411
+
412
+ class AsyncRunwayMLWithRawResponse:
413
+ def __init__(self, client: AsyncRunwayML) -> None:
414
+ self.tasks = resources.AsyncTasksResourceWithRawResponse(client.tasks)
415
+ self.image_to_video = resources.AsyncImageToVideoResourceWithRawResponse(client.image_to_video)
416
+
417
+
418
+ class RunwayMLWithStreamedResponse:
419
+ def __init__(self, client: RunwayML) -> None:
420
+ self.tasks = resources.TasksResourceWithStreamingResponse(client.tasks)
421
+ self.image_to_video = resources.ImageToVideoResourceWithStreamingResponse(client.image_to_video)
422
+
423
+
424
+ class AsyncRunwayMLWithStreamedResponse:
425
+ def __init__(self, client: AsyncRunwayML) -> None:
426
+ self.tasks = resources.AsyncTasksResourceWithStreamingResponse(client.tasks)
427
+ self.image_to_video = resources.AsyncImageToVideoResourceWithStreamingResponse(client.image_to_video)
428
+
429
+
430
+ Client = RunwayML
431
+
432
+ AsyncClient = AsyncRunwayML
runwayml/_compat.py ADDED
@@ -0,0 +1,217 @@
1
+ from __future__ import annotations
2
+
3
+ from typing import TYPE_CHECKING, Any, Union, Generic, TypeVar, Callable, cast, overload
4
+ from datetime import date, datetime
5
+ from typing_extensions import Self
6
+
7
+ import pydantic
8
+ from pydantic.fields import FieldInfo
9
+
10
+ from ._types import IncEx, StrBytesIntFloat
11
+
12
+ _T = TypeVar("_T")
13
+ _ModelT = TypeVar("_ModelT", bound=pydantic.BaseModel)
14
+
15
+ # --------------- Pydantic v2 compatibility ---------------
16
+
17
+ # Pyright incorrectly reports some of our functions as overriding a method when they don't
18
+ # pyright: reportIncompatibleMethodOverride=false
19
+
20
+ PYDANTIC_V2 = pydantic.VERSION.startswith("2.")
21
+
22
+ # v1 re-exports
23
+ if TYPE_CHECKING:
24
+
25
+ def parse_date(value: date | StrBytesIntFloat) -> date: # noqa: ARG001
26
+ ...
27
+
28
+ def parse_datetime(value: Union[datetime, StrBytesIntFloat]) -> datetime: # noqa: ARG001
29
+ ...
30
+
31
+ def get_args(t: type[Any]) -> tuple[Any, ...]: # noqa: ARG001
32
+ ...
33
+
34
+ def is_union(tp: type[Any] | None) -> bool: # noqa: ARG001
35
+ ...
36
+
37
+ def get_origin(t: type[Any]) -> type[Any] | None: # noqa: ARG001
38
+ ...
39
+
40
+ def is_literal_type(type_: type[Any]) -> bool: # noqa: ARG001
41
+ ...
42
+
43
+ def is_typeddict(type_: type[Any]) -> bool: # noqa: ARG001
44
+ ...
45
+
46
+ else:
47
+ if PYDANTIC_V2:
48
+ from pydantic.v1.typing import (
49
+ get_args as get_args,
50
+ is_union as is_union,
51
+ get_origin as get_origin,
52
+ is_typeddict as is_typeddict,
53
+ is_literal_type as is_literal_type,
54
+ )
55
+ from pydantic.v1.datetime_parse import parse_date as parse_date, parse_datetime as parse_datetime
56
+ else:
57
+ from pydantic.typing import (
58
+ get_args as get_args,
59
+ is_union as is_union,
60
+ get_origin as get_origin,
61
+ is_typeddict as is_typeddict,
62
+ is_literal_type as is_literal_type,
63
+ )
64
+ from pydantic.datetime_parse import parse_date as parse_date, parse_datetime as parse_datetime
65
+
66
+
67
+ # refactored config
68
+ if TYPE_CHECKING:
69
+ from pydantic import ConfigDict as ConfigDict
70
+ else:
71
+ if PYDANTIC_V2:
72
+ from pydantic import ConfigDict
73
+ else:
74
+ # TODO: provide an error message here?
75
+ ConfigDict = None
76
+
77
+
78
+ # renamed methods / properties
79
+ def parse_obj(model: type[_ModelT], value: object) -> _ModelT:
80
+ if PYDANTIC_V2:
81
+ return model.model_validate(value)
82
+ else:
83
+ return cast(_ModelT, model.parse_obj(value)) # pyright: ignore[reportDeprecated, reportUnnecessaryCast]
84
+
85
+
86
+ def field_is_required(field: FieldInfo) -> bool:
87
+ if PYDANTIC_V2:
88
+ return field.is_required()
89
+ return field.required # type: ignore
90
+
91
+
92
+ def field_get_default(field: FieldInfo) -> Any:
93
+ value = field.get_default()
94
+ if PYDANTIC_V2:
95
+ from pydantic_core import PydanticUndefined
96
+
97
+ if value == PydanticUndefined:
98
+ return None
99
+ return value
100
+ return value
101
+
102
+
103
+ def field_outer_type(field: FieldInfo) -> Any:
104
+ if PYDANTIC_V2:
105
+ return field.annotation
106
+ return field.outer_type_ # type: ignore
107
+
108
+
109
+ def get_model_config(model: type[pydantic.BaseModel]) -> Any:
110
+ if PYDANTIC_V2:
111
+ return model.model_config
112
+ return model.__config__ # type: ignore
113
+
114
+
115
+ def get_model_fields(model: type[pydantic.BaseModel]) -> dict[str, FieldInfo]:
116
+ if PYDANTIC_V2:
117
+ return model.model_fields
118
+ return model.__fields__ # type: ignore
119
+
120
+
121
+ def model_copy(model: _ModelT, *, deep: bool = False) -> _ModelT:
122
+ if PYDANTIC_V2:
123
+ return model.model_copy(deep=deep)
124
+ return model.copy(deep=deep) # type: ignore
125
+
126
+
127
+ def model_json(model: pydantic.BaseModel, *, indent: int | None = None) -> str:
128
+ if PYDANTIC_V2:
129
+ return model.model_dump_json(indent=indent)
130
+ return model.json(indent=indent) # type: ignore
131
+
132
+
133
+ def model_dump(
134
+ model: pydantic.BaseModel,
135
+ *,
136
+ exclude: IncEx = None,
137
+ exclude_unset: bool = False,
138
+ exclude_defaults: bool = False,
139
+ ) -> dict[str, Any]:
140
+ if PYDANTIC_V2:
141
+ return model.model_dump(
142
+ exclude=exclude,
143
+ exclude_unset=exclude_unset,
144
+ exclude_defaults=exclude_defaults,
145
+ )
146
+ return cast(
147
+ "dict[str, Any]",
148
+ model.dict( # pyright: ignore[reportDeprecated, reportUnnecessaryCast]
149
+ exclude=exclude,
150
+ exclude_unset=exclude_unset,
151
+ exclude_defaults=exclude_defaults,
152
+ ),
153
+ )
154
+
155
+
156
+ def model_parse(model: type[_ModelT], data: Any) -> _ModelT:
157
+ if PYDANTIC_V2:
158
+ return model.model_validate(data)
159
+ return model.parse_obj(data) # pyright: ignore[reportDeprecated]
160
+
161
+
162
+ # generic models
163
+ if TYPE_CHECKING:
164
+
165
+ class GenericModel(pydantic.BaseModel): ...
166
+
167
+ else:
168
+ if PYDANTIC_V2:
169
+ # there no longer needs to be a distinction in v2 but
170
+ # we still have to create our own subclass to avoid
171
+ # inconsistent MRO ordering errors
172
+ class GenericModel(pydantic.BaseModel): ...
173
+
174
+ else:
175
+ import pydantic.generics
176
+
177
+ class GenericModel(pydantic.generics.GenericModel, pydantic.BaseModel): ...
178
+
179
+
180
+ # cached properties
181
+ if TYPE_CHECKING:
182
+ cached_property = property
183
+
184
+ # we define a separate type (copied from typeshed)
185
+ # that represents that `cached_property` is `set`able
186
+ # at runtime, which differs from `@property`.
187
+ #
188
+ # this is a separate type as editors likely special case
189
+ # `@property` and we don't want to cause issues just to have
190
+ # more helpful internal types.
191
+
192
+ class typed_cached_property(Generic[_T]):
193
+ func: Callable[[Any], _T]
194
+ attrname: str | None
195
+
196
+ def __init__(self, func: Callable[[Any], _T]) -> None: ...
197
+
198
+ @overload
199
+ def __get__(self, instance: None, owner: type[Any] | None = None) -> Self: ...
200
+
201
+ @overload
202
+ def __get__(self, instance: object, owner: type[Any] | None = None) -> _T: ...
203
+
204
+ def __get__(self, instance: object, owner: type[Any] | None = None) -> _T | Self:
205
+ raise NotImplementedError()
206
+
207
+ def __set_name__(self, owner: type[Any], name: str) -> None: ...
208
+
209
+ # __set__ is not defined at runtime, but @cached_property is designed to be settable
210
+ def __set__(self, instance: object, value: _T) -> None: ...
211
+ else:
212
+ try:
213
+ from functools import cached_property as cached_property
214
+ except ImportError:
215
+ from cached_property import cached_property as cached_property
216
+
217
+ typed_cached_property = cached_property
runwayml/_constants.py ADDED
@@ -0,0 +1,14 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import httpx
4
+
5
+ RAW_RESPONSE_HEADER = "X-Stainless-Raw-Response"
6
+ OVERRIDE_CAST_TO_HEADER = "____stainless_override_cast_to"
7
+
8
+ # default timeout is 1 minute
9
+ DEFAULT_TIMEOUT = httpx.Timeout(timeout=60.0, connect=5.0)
10
+ DEFAULT_MAX_RETRIES = 2
11
+ DEFAULT_CONNECTION_LIMITS = httpx.Limits(max_connections=100, max_keepalive_connections=20)
12
+
13
+ INITIAL_RETRY_DELAY = 0.5
14
+ MAX_RETRY_DELAY = 8.0