modal 0.72.37__py3-none-any.whl → 0.72.39__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.
@@ -25,7 +25,7 @@ ReturnType = typing.TypeVar("ReturnType", covariant=True)
25
25
  OriginalReturnType = typing.TypeVar("OriginalReturnType", covariant=True)
26
26
 
27
27
  class _PartialFunction(typing.Generic[P, ReturnType, OriginalReturnType]):
28
- raw_f: typing.Callable[P, ReturnType]
28
+ raw_f: collections.abc.Callable[P, ReturnType]
29
29
  flags: _PartialFunctionFlags
30
30
  webhook_config: typing.Optional[modal_proto.api_pb2.WebhookConfig]
31
31
  is_generator: bool
@@ -38,7 +38,7 @@ class _PartialFunction(typing.Generic[P, ReturnType, OriginalReturnType]):
38
38
 
39
39
  def __init__(
40
40
  self,
41
- raw_f: typing.Callable[P, ReturnType],
41
+ raw_f: collections.abc.Callable[P, ReturnType],
42
42
  flags: _PartialFunctionFlags,
43
43
  webhook_config: typing.Optional[modal_proto.api_pb2.WebhookConfig] = None,
44
44
  is_generator: typing.Optional[bool] = None,
@@ -49,13 +49,13 @@ class _PartialFunction(typing.Generic[P, ReturnType, OriginalReturnType]):
49
49
  force_build: bool = False,
50
50
  build_timeout: typing.Optional[int] = None,
51
51
  ): ...
52
- def _get_raw_f(self) -> typing.Callable[P, ReturnType]: ...
52
+ def _get_raw_f(self) -> collections.abc.Callable[P, ReturnType]: ...
53
53
  def __get__(self, obj, objtype=None) -> modal.functions._Function[P, ReturnType, OriginalReturnType]: ...
54
54
  def __del__(self): ...
55
55
  def add_flags(self, flags) -> _PartialFunction: ...
56
56
 
57
57
  class PartialFunction(typing.Generic[P, ReturnType, OriginalReturnType]):
58
- raw_f: typing.Callable[P, ReturnType]
58
+ raw_f: collections.abc.Callable[P, ReturnType]
59
59
  flags: _PartialFunctionFlags
60
60
  webhook_config: typing.Optional[modal_proto.api_pb2.WebhookConfig]
61
61
  is_generator: bool
@@ -68,7 +68,7 @@ class PartialFunction(typing.Generic[P, ReturnType, OriginalReturnType]):
68
68
 
69
69
  def __init__(
70
70
  self,
71
- raw_f: typing.Callable[P, ReturnType],
71
+ raw_f: collections.abc.Callable[P, ReturnType],
72
72
  flags: _PartialFunctionFlags,
73
73
  webhook_config: typing.Optional[modal_proto.api_pb2.WebhookConfig] = None,
74
74
  is_generator: typing.Optional[bool] = None,
@@ -79,13 +79,15 @@ class PartialFunction(typing.Generic[P, ReturnType, OriginalReturnType]):
79
79
  force_build: bool = False,
80
80
  build_timeout: typing.Optional[int] = None,
81
81
  ): ...
82
- def _get_raw_f(self) -> typing.Callable[P, ReturnType]: ...
82
+ def _get_raw_f(self) -> collections.abc.Callable[P, ReturnType]: ...
83
83
  def __get__(self, obj, objtype=None) -> modal.functions.Function[P, ReturnType, OriginalReturnType]: ...
84
84
  def __del__(self): ...
85
85
  def add_flags(self, flags) -> PartialFunction: ...
86
86
 
87
87
  def _find_partial_methods_for_user_cls(user_cls: type[typing.Any], flags: int) -> dict[str, _PartialFunction]: ...
88
- def _find_callables_for_obj(user_obj: typing.Any, flags: int) -> dict[str, typing.Callable[..., typing.Any]]: ...
88
+ def _find_callables_for_obj(
89
+ user_obj: typing.Any, flags: int
90
+ ) -> dict[str, collections.abc.Callable[..., typing.Any]]: ...
89
91
 
90
92
  class _MethodDecoratorType:
91
93
  @typing.overload
@@ -95,13 +97,13 @@ class _MethodDecoratorType:
95
97
  @typing.overload
96
98
  def __call__(
97
99
  self,
98
- func: typing.Callable[
100
+ func: collections.abc.Callable[
99
101
  typing_extensions.Concatenate[typing.Any, P], collections.abc.Coroutine[typing.Any, typing.Any, ReturnType]
100
102
  ],
101
103
  ) -> PartialFunction[P, ReturnType, collections.abc.Coroutine[typing.Any, typing.Any, ReturnType]]: ...
102
104
  @typing.overload
103
105
  def __call__(
104
- self, func: typing.Callable[typing_extensions.Concatenate[typing.Any, P], ReturnType]
106
+ self, func: collections.abc.Callable[typing_extensions.Concatenate[typing.Any, P], ReturnType]
105
107
  ) -> PartialFunction[P, ReturnType, ReturnType]: ...
106
108
 
107
109
  def _method(
@@ -122,7 +124,9 @@ def _web_endpoint(
122
124
  custom_domains: typing.Optional[collections.abc.Iterable[str]] = None,
123
125
  requires_proxy_auth: bool = False,
124
126
  wait_for_response: bool = True,
125
- ) -> typing.Callable[[typing.Callable[P, ReturnType]], _PartialFunction[P, ReturnType, ReturnType]]: ...
127
+ ) -> collections.abc.Callable[
128
+ [collections.abc.Callable[P, ReturnType]], _PartialFunction[P, ReturnType, ReturnType]
129
+ ]: ...
126
130
  def _asgi_app(
127
131
  _warn_parentheses_missing=None,
128
132
  *,
@@ -130,7 +134,7 @@ def _asgi_app(
130
134
  custom_domains: typing.Optional[collections.abc.Iterable[str]] = None,
131
135
  requires_proxy_auth: bool = False,
132
136
  wait_for_response: bool = True,
133
- ) -> typing.Callable[[typing.Callable[..., typing.Any]], _PartialFunction]: ...
137
+ ) -> collections.abc.Callable[[collections.abc.Callable[..., typing.Any]], _PartialFunction]: ...
134
138
  def _wsgi_app(
135
139
  _warn_parentheses_missing=None,
136
140
  *,
@@ -138,7 +142,7 @@ def _wsgi_app(
138
142
  custom_domains: typing.Optional[collections.abc.Iterable[str]] = None,
139
143
  requires_proxy_auth: bool = False,
140
144
  wait_for_response: bool = True,
141
- ) -> typing.Callable[[typing.Callable[..., typing.Any]], _PartialFunction]: ...
145
+ ) -> collections.abc.Callable[[collections.abc.Callable[..., typing.Any]], _PartialFunction]: ...
142
146
  def _web_server(
143
147
  port: int,
144
148
  *,
@@ -146,31 +150,35 @@ def _web_server(
146
150
  label: typing.Optional[str] = None,
147
151
  custom_domains: typing.Optional[collections.abc.Iterable[str]] = None,
148
152
  requires_proxy_auth: bool = False,
149
- ) -> typing.Callable[[typing.Callable[..., typing.Any]], _PartialFunction]: ...
153
+ ) -> collections.abc.Callable[[collections.abc.Callable[..., typing.Any]], _PartialFunction]: ...
150
154
  def _disallow_wrapping_method(f: _PartialFunction, wrapper: str) -> None: ...
151
155
  def _build(
152
156
  _warn_parentheses_missing=None, *, force: bool = False, timeout: int = 86400
153
- ) -> typing.Callable[[typing.Union[typing.Callable[[typing.Any], typing.Any], _PartialFunction]], _PartialFunction]: ...
157
+ ) -> collections.abc.Callable[
158
+ [typing.Union[collections.abc.Callable[[typing.Any], typing.Any], _PartialFunction]], _PartialFunction
159
+ ]: ...
154
160
  def _enter(
155
161
  _warn_parentheses_missing=None, *, snap: bool = False
156
- ) -> typing.Callable[[typing.Union[typing.Callable[[typing.Any], typing.Any], _PartialFunction]], _PartialFunction]: ...
162
+ ) -> collections.abc.Callable[
163
+ [typing.Union[collections.abc.Callable[[typing.Any], typing.Any], _PartialFunction]], _PartialFunction
164
+ ]: ...
157
165
  def _exit(
158
166
  _warn_parentheses_missing=None,
159
- ) -> typing.Callable[
167
+ ) -> collections.abc.Callable[
160
168
  [
161
169
  typing.Union[
162
- typing.Callable[
170
+ collections.abc.Callable[
163
171
  [typing.Any, typing.Optional[type[BaseException]], typing.Optional[BaseException], typing.Any],
164
172
  typing.Any,
165
173
  ],
166
- typing.Callable[[typing.Any], typing.Any],
174
+ collections.abc.Callable[[typing.Any], typing.Any],
167
175
  ]
168
176
  ],
169
177
  _PartialFunction,
170
178
  ]: ...
171
179
  def _batched(
172
180
  _warn_parentheses_missing=None, *, max_batch_size: int, wait_ms: int
173
- ) -> typing.Callable[[typing.Callable[..., typing.Any]], _PartialFunction]: ...
181
+ ) -> collections.abc.Callable[[collections.abc.Callable[..., typing.Any]], _PartialFunction]: ...
174
182
  def method(
175
183
  _warn_parentheses_missing=None,
176
184
  *,
@@ -186,7 +194,9 @@ def web_endpoint(
186
194
  custom_domains: typing.Optional[collections.abc.Iterable[str]] = None,
187
195
  requires_proxy_auth: bool = False,
188
196
  wait_for_response: bool = True,
189
- ) -> typing.Callable[[typing.Callable[P, ReturnType]], PartialFunction[P, ReturnType, ReturnType]]: ...
197
+ ) -> collections.abc.Callable[
198
+ [collections.abc.Callable[P, ReturnType]], PartialFunction[P, ReturnType, ReturnType]
199
+ ]: ...
190
200
  def asgi_app(
191
201
  _warn_parentheses_missing=None,
192
202
  *,
@@ -194,7 +204,7 @@ def asgi_app(
194
204
  custom_domains: typing.Optional[collections.abc.Iterable[str]] = None,
195
205
  requires_proxy_auth: bool = False,
196
206
  wait_for_response: bool = True,
197
- ) -> typing.Callable[[typing.Callable[..., typing.Any]], PartialFunction]: ...
207
+ ) -> collections.abc.Callable[[collections.abc.Callable[..., typing.Any]], PartialFunction]: ...
198
208
  def wsgi_app(
199
209
  _warn_parentheses_missing=None,
200
210
  *,
@@ -202,7 +212,7 @@ def wsgi_app(
202
212
  custom_domains: typing.Optional[collections.abc.Iterable[str]] = None,
203
213
  requires_proxy_auth: bool = False,
204
214
  wait_for_response: bool = True,
205
- ) -> typing.Callable[[typing.Callable[..., typing.Any]], PartialFunction]: ...
215
+ ) -> collections.abc.Callable[[collections.abc.Callable[..., typing.Any]], PartialFunction]: ...
206
216
  def web_server(
207
217
  port: int,
208
218
  *,
@@ -210,27 +220,31 @@ def web_server(
210
220
  label: typing.Optional[str] = None,
211
221
  custom_domains: typing.Optional[collections.abc.Iterable[str]] = None,
212
222
  requires_proxy_auth: bool = False,
213
- ) -> typing.Callable[[typing.Callable[..., typing.Any]], PartialFunction]: ...
223
+ ) -> collections.abc.Callable[[collections.abc.Callable[..., typing.Any]], PartialFunction]: ...
214
224
  def build(
215
225
  _warn_parentheses_missing=None, *, force: bool = False, timeout: int = 86400
216
- ) -> typing.Callable[[typing.Union[typing.Callable[[typing.Any], typing.Any], PartialFunction]], PartialFunction]: ...
226
+ ) -> collections.abc.Callable[
227
+ [typing.Union[collections.abc.Callable[[typing.Any], typing.Any], PartialFunction]], PartialFunction
228
+ ]: ...
217
229
  def enter(
218
230
  _warn_parentheses_missing=None, *, snap: bool = False
219
- ) -> typing.Callable[[typing.Union[typing.Callable[[typing.Any], typing.Any], PartialFunction]], PartialFunction]: ...
231
+ ) -> collections.abc.Callable[
232
+ [typing.Union[collections.abc.Callable[[typing.Any], typing.Any], PartialFunction]], PartialFunction
233
+ ]: ...
220
234
  def exit(
221
235
  _warn_parentheses_missing=None,
222
- ) -> typing.Callable[
236
+ ) -> collections.abc.Callable[
223
237
  [
224
238
  typing.Union[
225
- typing.Callable[
239
+ collections.abc.Callable[
226
240
  [typing.Any, typing.Optional[type[BaseException]], typing.Optional[BaseException], typing.Any],
227
241
  typing.Any,
228
242
  ],
229
- typing.Callable[[typing.Any], typing.Any],
243
+ collections.abc.Callable[[typing.Any], typing.Any],
230
244
  ]
231
245
  ],
232
246
  PartialFunction,
233
247
  ]: ...
234
248
  def batched(
235
249
  _warn_parentheses_missing=None, *, max_batch_size: int, wait_ms: int
236
- ) -> typing.Callable[[typing.Callable[..., typing.Any]], PartialFunction]: ...
250
+ ) -> collections.abc.Callable[[collections.abc.Callable[..., typing.Any]], PartialFunction]: ...
modal/queue.pyi CHANGED
@@ -85,6 +85,8 @@ class _Queue(modal._object._Object):
85
85
  self, *, partition: typing.Optional[str] = None, item_poll_timeout: float = 0.0
86
86
  ) -> collections.abc.AsyncGenerator[typing.Any, None]: ...
87
87
 
88
+ SUPERSELF = typing.TypeVar("SUPERSELF", covariant=True)
89
+
88
90
  class Queue(modal.object.Object):
89
91
  def __init__(self): ...
90
92
  @staticmethod
@@ -139,13 +141,13 @@ class Queue(modal.object.Object):
139
141
 
140
142
  delete: __delete_spec
141
143
 
142
- class ___get_nonblocking_spec(typing_extensions.Protocol):
144
+ class ___get_nonblocking_spec(typing_extensions.Protocol[SUPERSELF]):
143
145
  def __call__(self, partition: typing.Optional[str], n_values: int) -> list[typing.Any]: ...
144
146
  async def aio(self, partition: typing.Optional[str], n_values: int) -> list[typing.Any]: ...
145
147
 
146
- _get_nonblocking: ___get_nonblocking_spec
148
+ _get_nonblocking: ___get_nonblocking_spec[typing_extensions.Self]
147
149
 
148
- class ___get_blocking_spec(typing_extensions.Protocol):
150
+ class ___get_blocking_spec(typing_extensions.Protocol[SUPERSELF]):
149
151
  def __call__(
150
152
  self, partition: typing.Optional[str], timeout: typing.Optional[float], n_values: int
151
153
  ) -> list[typing.Any]: ...
@@ -153,15 +155,15 @@ class Queue(modal.object.Object):
153
155
  self, partition: typing.Optional[str], timeout: typing.Optional[float], n_values: int
154
156
  ) -> list[typing.Any]: ...
155
157
 
156
- _get_blocking: ___get_blocking_spec
158
+ _get_blocking: ___get_blocking_spec[typing_extensions.Self]
157
159
 
158
- class __clear_spec(typing_extensions.Protocol):
160
+ class __clear_spec(typing_extensions.Protocol[SUPERSELF]):
159
161
  def __call__(self, *, partition: typing.Optional[str] = None, all: bool = False) -> None: ...
160
162
  async def aio(self, *, partition: typing.Optional[str] = None, all: bool = False) -> None: ...
161
163
 
162
- clear: __clear_spec
164
+ clear: __clear_spec[typing_extensions.Self]
163
165
 
164
- class __get_spec(typing_extensions.Protocol):
166
+ class __get_spec(typing_extensions.Protocol[SUPERSELF]):
165
167
  def __call__(
166
168
  self, block: bool = True, timeout: typing.Optional[float] = None, *, partition: typing.Optional[str] = None
167
169
  ) -> typing.Optional[typing.Any]: ...
@@ -169,9 +171,9 @@ class Queue(modal.object.Object):
169
171
  self, block: bool = True, timeout: typing.Optional[float] = None, *, partition: typing.Optional[str] = None
170
172
  ) -> typing.Optional[typing.Any]: ...
171
173
 
172
- get: __get_spec
174
+ get: __get_spec[typing_extensions.Self]
173
175
 
174
- class __get_many_spec(typing_extensions.Protocol):
176
+ class __get_many_spec(typing_extensions.Protocol[SUPERSELF]):
175
177
  def __call__(
176
178
  self,
177
179
  n_values: int,
@@ -189,9 +191,9 @@ class Queue(modal.object.Object):
189
191
  partition: typing.Optional[str] = None,
190
192
  ) -> list[typing.Any]: ...
191
193
 
192
- get_many: __get_many_spec
194
+ get_many: __get_many_spec[typing_extensions.Self]
193
195
 
194
- class __put_spec(typing_extensions.Protocol):
196
+ class __put_spec(typing_extensions.Protocol[SUPERSELF]):
195
197
  def __call__(
196
198
  self,
197
199
  v: typing.Any,
@@ -211,9 +213,9 @@ class Queue(modal.object.Object):
211
213
  partition_ttl: int = 86400,
212
214
  ) -> None: ...
213
215
 
214
- put: __put_spec
216
+ put: __put_spec[typing_extensions.Self]
215
217
 
216
- class __put_many_spec(typing_extensions.Protocol):
218
+ class __put_many_spec(typing_extensions.Protocol[SUPERSELF]):
217
219
  def __call__(
218
220
  self,
219
221
  vs: list[typing.Any],
@@ -233,9 +235,9 @@ class Queue(modal.object.Object):
233
235
  partition_ttl: int = 86400,
234
236
  ) -> None: ...
235
237
 
236
- put_many: __put_many_spec
238
+ put_many: __put_many_spec[typing_extensions.Self]
237
239
 
238
- class ___put_many_blocking_spec(typing_extensions.Protocol):
240
+ class ___put_many_blocking_spec(typing_extensions.Protocol[SUPERSELF]):
239
241
  def __call__(
240
242
  self,
241
243
  partition: typing.Optional[str],
@@ -251,21 +253,21 @@ class Queue(modal.object.Object):
251
253
  timeout: typing.Optional[float] = None,
252
254
  ): ...
253
255
 
254
- _put_many_blocking: ___put_many_blocking_spec
256
+ _put_many_blocking: ___put_many_blocking_spec[typing_extensions.Self]
255
257
 
256
- class ___put_many_nonblocking_spec(typing_extensions.Protocol):
258
+ class ___put_many_nonblocking_spec(typing_extensions.Protocol[SUPERSELF]):
257
259
  def __call__(self, partition: typing.Optional[str], partition_ttl: int, vs: list[typing.Any]): ...
258
260
  async def aio(self, partition: typing.Optional[str], partition_ttl: int, vs: list[typing.Any]): ...
259
261
 
260
- _put_many_nonblocking: ___put_many_nonblocking_spec
262
+ _put_many_nonblocking: ___put_many_nonblocking_spec[typing_extensions.Self]
261
263
 
262
- class __len_spec(typing_extensions.Protocol):
264
+ class __len_spec(typing_extensions.Protocol[SUPERSELF]):
263
265
  def __call__(self, *, partition: typing.Optional[str] = None, total: bool = False) -> int: ...
264
266
  async def aio(self, *, partition: typing.Optional[str] = None, total: bool = False) -> int: ...
265
267
 
266
- len: __len_spec
268
+ len: __len_spec[typing_extensions.Self]
267
269
 
268
- class __iterate_spec(typing_extensions.Protocol):
270
+ class __iterate_spec(typing_extensions.Protocol[SUPERSELF]):
269
271
  def __call__(
270
272
  self, *, partition: typing.Optional[str] = None, item_poll_timeout: float = 0.0
271
273
  ) -> typing.Generator[typing.Any, None, None]: ...
@@ -273,4 +275,4 @@ class Queue(modal.object.Object):
273
275
  self, *, partition: typing.Optional[str] = None, item_poll_timeout: float = 0.0
274
276
  ) -> collections.abc.AsyncGenerator[typing.Any, None]: ...
275
277
 
276
- iterate: __iterate_spec
278
+ iterate: __iterate_spec[typing_extensions.Self]
modal/sandbox.py CHANGED
@@ -517,8 +517,9 @@ class _Sandbox(_Object, type_prefix="sb"):
517
517
  raise InvalidError(f"workdir must be an absolute path, got: {workdir}")
518
518
 
519
519
  # Force secret resolution so we can pass the secret IDs to the backend.
520
+ # TODO should we parallelize this?
520
521
  for secret in secrets:
521
- await secret.resolve(client=self._client)
522
+ await secret.hydrate(client=self._client)
522
523
 
523
524
  task_id = await self._get_task_id()
524
525
  req = api_pb2.ContainerExecRequest(
modal/sandbox.pyi CHANGED
@@ -155,6 +155,8 @@ class _Sandbox(modal._object._Object):
155
155
  client: typing.Optional[modal.client._Client] = None,
156
156
  ) -> collections.abc.AsyncGenerator[_Sandbox, None]: ...
157
157
 
158
+ SUPERSELF = typing.TypeVar("SUPERSELF", covariant=True)
159
+
158
160
  class Sandbox(modal.object.Object):
159
161
  _result: typing.Optional[modal_proto.api_pb2.GenericResult]
160
162
  _stdout: modal.io_streams.StreamReader[str]
@@ -264,49 +266,49 @@ class Sandbox(modal.object.Object):
264
266
 
265
267
  from_id: __from_id_spec
266
268
 
267
- class __set_tags_spec(typing_extensions.Protocol):
269
+ class __set_tags_spec(typing_extensions.Protocol[SUPERSELF]):
268
270
  def __call__(self, tags: dict[str, str], *, client: typing.Optional[modal.client.Client] = None): ...
269
271
  async def aio(self, tags: dict[str, str], *, client: typing.Optional[modal.client.Client] = None): ...
270
272
 
271
- set_tags: __set_tags_spec
273
+ set_tags: __set_tags_spec[typing_extensions.Self]
272
274
 
273
- class __snapshot_filesystem_spec(typing_extensions.Protocol):
275
+ class __snapshot_filesystem_spec(typing_extensions.Protocol[SUPERSELF]):
274
276
  def __call__(self, timeout: int = 55) -> modal.image.Image: ...
275
277
  async def aio(self, timeout: int = 55) -> modal.image.Image: ...
276
278
 
277
- snapshot_filesystem: __snapshot_filesystem_spec
279
+ snapshot_filesystem: __snapshot_filesystem_spec[typing_extensions.Self]
278
280
 
279
- class __wait_spec(typing_extensions.Protocol):
281
+ class __wait_spec(typing_extensions.Protocol[SUPERSELF]):
280
282
  def __call__(self, raise_on_termination: bool = True): ...
281
283
  async def aio(self, raise_on_termination: bool = True): ...
282
284
 
283
- wait: __wait_spec
285
+ wait: __wait_spec[typing_extensions.Self]
284
286
 
285
- class __tunnels_spec(typing_extensions.Protocol):
287
+ class __tunnels_spec(typing_extensions.Protocol[SUPERSELF]):
286
288
  def __call__(self, timeout: int = 50) -> dict[int, modal._tunnel.Tunnel]: ...
287
289
  async def aio(self, timeout: int = 50) -> dict[int, modal._tunnel.Tunnel]: ...
288
290
 
289
- tunnels: __tunnels_spec
291
+ tunnels: __tunnels_spec[typing_extensions.Self]
290
292
 
291
- class __terminate_spec(typing_extensions.Protocol):
293
+ class __terminate_spec(typing_extensions.Protocol[SUPERSELF]):
292
294
  def __call__(self): ...
293
295
  async def aio(self): ...
294
296
 
295
- terminate: __terminate_spec
297
+ terminate: __terminate_spec[typing_extensions.Self]
296
298
 
297
- class __poll_spec(typing_extensions.Protocol):
299
+ class __poll_spec(typing_extensions.Protocol[SUPERSELF]):
298
300
  def __call__(self) -> typing.Optional[int]: ...
299
301
  async def aio(self) -> typing.Optional[int]: ...
300
302
 
301
- poll: __poll_spec
303
+ poll: __poll_spec[typing_extensions.Self]
302
304
 
303
- class ___get_task_id_spec(typing_extensions.Protocol):
305
+ class ___get_task_id_spec(typing_extensions.Protocol[SUPERSELF]):
304
306
  def __call__(self): ...
305
307
  async def aio(self): ...
306
308
 
307
- _get_task_id: ___get_task_id_spec
309
+ _get_task_id: ___get_task_id_spec[typing_extensions.Self]
308
310
 
309
- class __exec_spec(typing_extensions.Protocol):
311
+ class __exec_spec(typing_extensions.Protocol[SUPERSELF]):
310
312
  @typing.overload
311
313
  def __call__(
312
314
  self,
@@ -364,9 +366,9 @@ class Sandbox(modal.object.Object):
364
366
  _pty_info: typing.Optional[modal_proto.api_pb2.PTYInfo] = None,
365
367
  ) -> modal.container_process.ContainerProcess[bytes]: ...
366
368
 
367
- exec: __exec_spec
369
+ exec: __exec_spec[typing_extensions.Self]
368
370
 
369
- class __open_spec(typing_extensions.Protocol):
371
+ class __open_spec(typing_extensions.Protocol[SUPERSELF]):
370
372
  @typing.overload
371
373
  def __call__(self, path: str, mode: _typeshed.OpenTextMode) -> modal.file_io.FileIO[str]: ...
372
374
  @typing.overload
@@ -376,27 +378,27 @@ class Sandbox(modal.object.Object):
376
378
  @typing.overload
377
379
  async def aio(self, path: str, mode: _typeshed.OpenBinaryMode) -> modal.file_io.FileIO[bytes]: ...
378
380
 
379
- open: __open_spec
381
+ open: __open_spec[typing_extensions.Self]
380
382
 
381
- class __ls_spec(typing_extensions.Protocol):
383
+ class __ls_spec(typing_extensions.Protocol[SUPERSELF]):
382
384
  def __call__(self, path: str) -> list[str]: ...
383
385
  async def aio(self, path: str) -> list[str]: ...
384
386
 
385
- ls: __ls_spec
387
+ ls: __ls_spec[typing_extensions.Self]
386
388
 
387
- class __mkdir_spec(typing_extensions.Protocol):
389
+ class __mkdir_spec(typing_extensions.Protocol[SUPERSELF]):
388
390
  def __call__(self, path: str, parents: bool = False) -> None: ...
389
391
  async def aio(self, path: str, parents: bool = False) -> None: ...
390
392
 
391
- mkdir: __mkdir_spec
393
+ mkdir: __mkdir_spec[typing_extensions.Self]
392
394
 
393
- class __rm_spec(typing_extensions.Protocol):
395
+ class __rm_spec(typing_extensions.Protocol[SUPERSELF]):
394
396
  def __call__(self, path: str, recursive: bool = False) -> None: ...
395
397
  async def aio(self, path: str, recursive: bool = False) -> None: ...
396
398
 
397
- rm: __rm_spec
399
+ rm: __rm_spec[typing_extensions.Self]
398
400
 
399
- class __watch_spec(typing_extensions.Protocol):
401
+ class __watch_spec(typing_extensions.Protocol[SUPERSELF]):
400
402
  def __call__(
401
403
  self,
402
404
  path: str,
@@ -412,7 +414,7 @@ class Sandbox(modal.object.Object):
412
414
  timeout: typing.Optional[int] = None,
413
415
  ) -> typing.AsyncIterator[modal.file_io.FileWatchEvent]: ...
414
416
 
415
- watch: __watch_spec
417
+ watch: __watch_spec[typing_extensions.Self]
416
418
 
417
419
  @property
418
420
  def stdout(self) -> modal.io_streams.StreamReader[str]: ...
modal/token_flow.pyi CHANGED
@@ -13,10 +13,12 @@ class _TokenFlow:
13
13
  self, timeout: float = 40.0, grpc_extra_timeout: float = 5.0
14
14
  ) -> typing.Optional[modal_proto.api_pb2.TokenFlowWaitResponse]: ...
15
15
 
16
+ SUPERSELF = typing.TypeVar("SUPERSELF", covariant=True)
17
+
16
18
  class TokenFlow:
17
19
  def __init__(self, client: modal.client.Client): ...
18
20
 
19
- class __start_spec(typing_extensions.Protocol):
21
+ class __start_spec(typing_extensions.Protocol[SUPERSELF]):
20
22
  def __call__(
21
23
  self, utm_source: typing.Optional[str] = None, next_url: typing.Optional[str] = None
22
24
  ) -> synchronicity.combined_types.AsyncAndBlockingContextManager[tuple[str, str, str]]: ...
@@ -24,9 +26,9 @@ class TokenFlow:
24
26
  self, utm_source: typing.Optional[str] = None, next_url: typing.Optional[str] = None
25
27
  ) -> typing.AsyncContextManager[tuple[str, str, str]]: ...
26
28
 
27
- start: __start_spec
29
+ start: __start_spec[typing_extensions.Self]
28
30
 
29
- class __finish_spec(typing_extensions.Protocol):
31
+ class __finish_spec(typing_extensions.Protocol[SUPERSELF]):
30
32
  def __call__(
31
33
  self, timeout: float = 40.0, grpc_extra_timeout: float = 5.0
32
34
  ) -> typing.Optional[modal_proto.api_pb2.TokenFlowWaitResponse]: ...
@@ -34,7 +36,7 @@ class TokenFlow:
34
36
  self, timeout: float = 40.0, grpc_extra_timeout: float = 5.0
35
37
  ) -> typing.Optional[modal_proto.api_pb2.TokenFlowWaitResponse]: ...
36
38
 
37
- finish: __finish_spec
39
+ finish: __finish_spec[typing_extensions.Self]
38
40
 
39
41
  async def _new_token(
40
42
  *,