modal 0.72.38__py3-none-any.whl → 0.72.40__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.
modal/mount.pyi CHANGED
@@ -36,7 +36,7 @@ class _MountFile(_MountEntry):
36
36
  class _MountDir(_MountEntry):
37
37
  local_dir: pathlib.Path
38
38
  remote_path: pathlib.PurePosixPath
39
- ignore: typing.Callable[[pathlib.Path], bool]
39
+ ignore: collections.abc.Callable[[pathlib.Path], bool]
40
40
  recursive: bool
41
41
 
42
42
  def description(self): ...
@@ -47,7 +47,7 @@ class _MountDir(_MountEntry):
47
47
  self,
48
48
  local_dir: pathlib.Path,
49
49
  remote_path: pathlib.PurePosixPath,
50
- ignore: typing.Callable[[pathlib.Path], bool],
50
+ ignore: collections.abc.Callable[[pathlib.Path], bool],
51
51
  recursive: bool,
52
52
  ) -> None: ...
53
53
  def __repr__(self): ...
@@ -59,7 +59,7 @@ def module_mount_ignore_condition(module_base: pathlib.Path): ...
59
59
  class _MountedPythonModule(_MountEntry):
60
60
  module_name: str
61
61
  remote_dir: typing.Union[pathlib.PurePosixPath, str]
62
- ignore: typing.Optional[typing.Callable[[pathlib.Path], bool]]
62
+ ignore: typing.Optional[collections.abc.Callable[[pathlib.Path], bool]]
63
63
 
64
64
  def description(self) -> str: ...
65
65
  def _proxy_entries(self) -> list[_MountEntry]: ...
@@ -70,7 +70,7 @@ class _MountedPythonModule(_MountEntry):
70
70
  self,
71
71
  module_name: str,
72
72
  remote_dir: typing.Union[pathlib.PurePosixPath, str] = "/root",
73
- ignore: typing.Optional[typing.Callable[[pathlib.Path], bool]] = None,
73
+ ignore: typing.Optional[collections.abc.Callable[[pathlib.Path], bool]] = None,
74
74
  ) -> None: ...
75
75
  def __repr__(self): ...
76
76
  def __eq__(self, other): ...
@@ -96,14 +96,14 @@ class _Mount(modal._object._Object):
96
96
  def _add_local_dir(
97
97
  local_path: pathlib.Path,
98
98
  remote_path: pathlib.PurePosixPath,
99
- ignore: typing.Callable[[pathlib.Path], bool] = modal.file_pattern_matcher._NOTHING,
99
+ ignore: collections.abc.Callable[[pathlib.Path], bool] = modal.file_pattern_matcher._NOTHING,
100
100
  ): ...
101
101
  def add_local_dir(
102
102
  self,
103
103
  local_path: typing.Union[str, pathlib.Path],
104
104
  *,
105
105
  remote_path: typing.Union[str, pathlib.PurePosixPath, None] = None,
106
- condition: typing.Optional[typing.Callable[[str], bool]] = None,
106
+ condition: typing.Optional[collections.abc.Callable[[str], bool]] = None,
107
107
  recursive: bool = True,
108
108
  ) -> _Mount: ...
109
109
  @staticmethod
@@ -111,7 +111,7 @@ class _Mount(modal._object._Object):
111
111
  local_path: typing.Union[str, pathlib.Path],
112
112
  *,
113
113
  remote_path: typing.Union[str, pathlib.PurePosixPath, None] = None,
114
- condition: typing.Optional[typing.Callable[[str], bool]] = None,
114
+ condition: typing.Optional[collections.abc.Callable[[str], bool]] = None,
115
115
  recursive: bool = True,
116
116
  ) -> _Mount: ...
117
117
  @staticmethod
@@ -119,7 +119,7 @@ class _Mount(modal._object._Object):
119
119
  local_path: typing.Union[str, pathlib.Path],
120
120
  *,
121
121
  remote_path: typing.Union[str, pathlib.PurePosixPath, None] = None,
122
- condition: typing.Optional[typing.Callable[[str], bool]] = None,
122
+ condition: typing.Optional[collections.abc.Callable[[str], bool]] = None,
123
123
  recursive: bool = True,
124
124
  ) -> _Mount: ...
125
125
  def add_local_file(
@@ -148,15 +148,15 @@ class _Mount(modal._object._Object):
148
148
  def from_local_python_packages(
149
149
  *module_names: str,
150
150
  remote_dir: typing.Union[str, pathlib.PurePosixPath] = "/root",
151
- condition: typing.Optional[typing.Callable[[str], bool]] = None,
152
- ignore: typing.Union[typing.Sequence[str], typing.Callable[[pathlib.Path], bool], None] = None,
151
+ condition: typing.Optional[collections.abc.Callable[[str], bool]] = None,
152
+ ignore: typing.Union[typing.Sequence[str], collections.abc.Callable[[pathlib.Path], bool], None] = None,
153
153
  ) -> _Mount: ...
154
154
  @staticmethod
155
155
  def _from_local_python_packages(
156
156
  *module_names: str,
157
157
  remote_dir: typing.Union[str, pathlib.PurePosixPath] = "/root",
158
- condition: typing.Optional[typing.Callable[[str], bool]] = None,
159
- ignore: typing.Union[typing.Sequence[str], typing.Callable[[pathlib.Path], bool], None] = None,
158
+ condition: typing.Optional[collections.abc.Callable[[str], bool]] = None,
159
+ ignore: typing.Union[typing.Sequence[str], collections.abc.Callable[[pathlib.Path], bool], None] = None,
160
160
  ) -> _Mount: ...
161
161
  @staticmethod
162
162
  def from_name(name: str, namespace=1, environment_name: typing.Optional[str] = None) -> _Mount: ...
@@ -177,6 +177,8 @@ class _Mount(modal._object._Object):
177
177
  ) -> None: ...
178
178
  def _get_metadata(self) -> modal_proto.api_pb2.MountHandleMetadata: ...
179
179
 
180
+ SUPERSELF = typing.TypeVar("SUPERSELF", covariant=True)
181
+
180
182
  class Mount(modal.object.Object):
181
183
  _entries: typing.Optional[list[_MountEntry]]
182
184
  _deployment_name: typing.Optional[str]
@@ -197,14 +199,14 @@ class Mount(modal.object.Object):
197
199
  def _add_local_dir(
198
200
  local_path: pathlib.Path,
199
201
  remote_path: pathlib.PurePosixPath,
200
- ignore: typing.Callable[[pathlib.Path], bool] = modal.file_pattern_matcher._NOTHING,
202
+ ignore: collections.abc.Callable[[pathlib.Path], bool] = modal.file_pattern_matcher._NOTHING,
201
203
  ): ...
202
204
  def add_local_dir(
203
205
  self,
204
206
  local_path: typing.Union[str, pathlib.Path],
205
207
  *,
206
208
  remote_path: typing.Union[str, pathlib.PurePosixPath, None] = None,
207
- condition: typing.Optional[typing.Callable[[str], bool]] = None,
209
+ condition: typing.Optional[collections.abc.Callable[[str], bool]] = None,
208
210
  recursive: bool = True,
209
211
  ) -> Mount: ...
210
212
  @staticmethod
@@ -212,7 +214,7 @@ class Mount(modal.object.Object):
212
214
  local_path: typing.Union[str, pathlib.Path],
213
215
  *,
214
216
  remote_path: typing.Union[str, pathlib.PurePosixPath, None] = None,
215
- condition: typing.Optional[typing.Callable[[str], bool]] = None,
217
+ condition: typing.Optional[collections.abc.Callable[[str], bool]] = None,
216
218
  recursive: bool = True,
217
219
  ) -> Mount: ...
218
220
  @staticmethod
@@ -220,7 +222,7 @@ class Mount(modal.object.Object):
220
222
  local_path: typing.Union[str, pathlib.Path],
221
223
  *,
222
224
  remote_path: typing.Union[str, pathlib.PurePosixPath, None] = None,
223
- condition: typing.Optional[typing.Callable[[str], bool]] = None,
225
+ condition: typing.Optional[collections.abc.Callable[[str], bool]] = None,
224
226
  recursive: bool = True,
225
227
  ) -> Mount: ...
226
228
  def add_local_file(
@@ -249,25 +251,25 @@ class Mount(modal.object.Object):
249
251
 
250
252
  _get_files: ___get_files_spec
251
253
 
252
- class ___load_mount_spec(typing_extensions.Protocol):
254
+ class ___load_mount_spec(typing_extensions.Protocol[SUPERSELF]):
253
255
  def __call__(self, resolver: modal._resolver.Resolver, existing_object_id: typing.Optional[str]): ...
254
256
  async def aio(self, resolver: modal._resolver.Resolver, existing_object_id: typing.Optional[str]): ...
255
257
 
256
- _load_mount: ___load_mount_spec
258
+ _load_mount: ___load_mount_spec[typing_extensions.Self]
257
259
 
258
260
  @staticmethod
259
261
  def from_local_python_packages(
260
262
  *module_names: str,
261
263
  remote_dir: typing.Union[str, pathlib.PurePosixPath] = "/root",
262
- condition: typing.Optional[typing.Callable[[str], bool]] = None,
263
- ignore: typing.Union[typing.Sequence[str], typing.Callable[[pathlib.Path], bool], None] = None,
264
+ condition: typing.Optional[collections.abc.Callable[[str], bool]] = None,
265
+ ignore: typing.Union[typing.Sequence[str], collections.abc.Callable[[pathlib.Path], bool], None] = None,
264
266
  ) -> Mount: ...
265
267
  @staticmethod
266
268
  def _from_local_python_packages(
267
269
  *module_names: str,
268
270
  remote_dir: typing.Union[str, pathlib.PurePosixPath] = "/root",
269
- condition: typing.Optional[typing.Callable[[str], bool]] = None,
270
- ignore: typing.Union[typing.Sequence[str], typing.Callable[[pathlib.Path], bool], None] = None,
271
+ condition: typing.Optional[collections.abc.Callable[[str], bool]] = None,
272
+ ignore: typing.Union[typing.Sequence[str], collections.abc.Callable[[pathlib.Path], bool], None] = None,
271
273
  ) -> Mount: ...
272
274
  @staticmethod
273
275
  def from_name(name: str, namespace=1, environment_name: typing.Optional[str] = None) -> Mount: ...
@@ -280,7 +282,7 @@ class Mount(modal.object.Object):
280
282
  environment_name: typing.Optional[str] = None,
281
283
  ) -> Mount: ...
282
284
 
283
- class ___deploy_spec(typing_extensions.Protocol):
285
+ class ___deploy_spec(typing_extensions.Protocol[SUPERSELF]):
284
286
  def __call__(
285
287
  self,
286
288
  deployment_name: typing.Optional[str] = None,
@@ -296,7 +298,7 @@ class Mount(modal.object.Object):
296
298
  client: typing.Optional[modal.client.Client] = None,
297
299
  ) -> None: ...
298
300
 
299
- _deploy: ___deploy_spec
301
+ _deploy: ___deploy_spec[typing_extensions.Self]
300
302
 
301
303
  def _get_metadata(self) -> modal_proto.api_pb2.MountHandleMetadata: ...
302
304
 
@@ -48,7 +48,7 @@ class _NetworkFileSystem(modal._object._Object):
48
48
  self,
49
49
  remote_path: str,
50
50
  fp: typing.BinaryIO,
51
- progress_cb: typing.Optional[typing.Callable[..., typing.Any]] = None,
51
+ progress_cb: typing.Optional[collections.abc.Callable[..., typing.Any]] = None,
52
52
  ) -> int: ...
53
53
  def read_file(self, path: str) -> collections.abc.AsyncIterator[bytes]: ...
54
54
  def iterdir(self, path: str) -> collections.abc.AsyncIterator[modal.volume.FileEntry]: ...
@@ -56,17 +56,19 @@ class _NetworkFileSystem(modal._object._Object):
56
56
  self,
57
57
  local_path: typing.Union[pathlib.Path, str],
58
58
  remote_path: typing.Union[str, pathlib.PurePosixPath, None] = None,
59
- progress_cb: typing.Optional[typing.Callable[..., typing.Any]] = None,
59
+ progress_cb: typing.Optional[collections.abc.Callable[..., typing.Any]] = None,
60
60
  ): ...
61
61
  async def add_local_dir(
62
62
  self,
63
63
  local_path: typing.Union[pathlib.Path, str],
64
64
  remote_path: typing.Union[str, pathlib.PurePosixPath, None] = None,
65
- progress_cb: typing.Optional[typing.Callable[..., typing.Any]] = None,
65
+ progress_cb: typing.Optional[collections.abc.Callable[..., typing.Any]] = None,
66
66
  ): ...
67
67
  async def listdir(self, path: str) -> list[modal.volume.FileEntry]: ...
68
68
  async def remove_file(self, path: str, recursive=False): ...
69
69
 
70
+ SUPERSELF = typing.TypeVar("SUPERSELF", covariant=True)
71
+
70
72
  class NetworkFileSystem(modal.object.Object):
71
73
  def __init__(self, *args, **kwargs): ...
72
74
  @staticmethod
@@ -135,74 +137,74 @@ class NetworkFileSystem(modal.object.Object):
135
137
 
136
138
  delete: __delete_spec
137
139
 
138
- class __write_file_spec(typing_extensions.Protocol):
140
+ class __write_file_spec(typing_extensions.Protocol[SUPERSELF]):
139
141
  def __call__(
140
142
  self,
141
143
  remote_path: str,
142
144
  fp: typing.BinaryIO,
143
- progress_cb: typing.Optional[typing.Callable[..., typing.Any]] = None,
145
+ progress_cb: typing.Optional[collections.abc.Callable[..., typing.Any]] = None,
144
146
  ) -> int: ...
145
147
  async def aio(
146
148
  self,
147
149
  remote_path: str,
148
150
  fp: typing.BinaryIO,
149
- progress_cb: typing.Optional[typing.Callable[..., typing.Any]] = None,
151
+ progress_cb: typing.Optional[collections.abc.Callable[..., typing.Any]] = None,
150
152
  ) -> int: ...
151
153
 
152
- write_file: __write_file_spec
154
+ write_file: __write_file_spec[typing_extensions.Self]
153
155
 
154
- class __read_file_spec(typing_extensions.Protocol):
156
+ class __read_file_spec(typing_extensions.Protocol[SUPERSELF]):
155
157
  def __call__(self, path: str) -> typing.Iterator[bytes]: ...
156
158
  def aio(self, path: str) -> collections.abc.AsyncIterator[bytes]: ...
157
159
 
158
- read_file: __read_file_spec
160
+ read_file: __read_file_spec[typing_extensions.Self]
159
161
 
160
- class __iterdir_spec(typing_extensions.Protocol):
162
+ class __iterdir_spec(typing_extensions.Protocol[SUPERSELF]):
161
163
  def __call__(self, path: str) -> typing.Iterator[modal.volume.FileEntry]: ...
162
164
  def aio(self, path: str) -> collections.abc.AsyncIterator[modal.volume.FileEntry]: ...
163
165
 
164
- iterdir: __iterdir_spec
166
+ iterdir: __iterdir_spec[typing_extensions.Self]
165
167
 
166
- class __add_local_file_spec(typing_extensions.Protocol):
168
+ class __add_local_file_spec(typing_extensions.Protocol[SUPERSELF]):
167
169
  def __call__(
168
170
  self,
169
171
  local_path: typing.Union[pathlib.Path, str],
170
172
  remote_path: typing.Union[str, pathlib.PurePosixPath, None] = None,
171
- progress_cb: typing.Optional[typing.Callable[..., typing.Any]] = None,
173
+ progress_cb: typing.Optional[collections.abc.Callable[..., typing.Any]] = None,
172
174
  ): ...
173
175
  async def aio(
174
176
  self,
175
177
  local_path: typing.Union[pathlib.Path, str],
176
178
  remote_path: typing.Union[str, pathlib.PurePosixPath, None] = None,
177
- progress_cb: typing.Optional[typing.Callable[..., typing.Any]] = None,
179
+ progress_cb: typing.Optional[collections.abc.Callable[..., typing.Any]] = None,
178
180
  ): ...
179
181
 
180
- add_local_file: __add_local_file_spec
182
+ add_local_file: __add_local_file_spec[typing_extensions.Self]
181
183
 
182
- class __add_local_dir_spec(typing_extensions.Protocol):
184
+ class __add_local_dir_spec(typing_extensions.Protocol[SUPERSELF]):
183
185
  def __call__(
184
186
  self,
185
187
  local_path: typing.Union[pathlib.Path, str],
186
188
  remote_path: typing.Union[str, pathlib.PurePosixPath, None] = None,
187
- progress_cb: typing.Optional[typing.Callable[..., typing.Any]] = None,
189
+ progress_cb: typing.Optional[collections.abc.Callable[..., typing.Any]] = None,
188
190
  ): ...
189
191
  async def aio(
190
192
  self,
191
193
  local_path: typing.Union[pathlib.Path, str],
192
194
  remote_path: typing.Union[str, pathlib.PurePosixPath, None] = None,
193
- progress_cb: typing.Optional[typing.Callable[..., typing.Any]] = None,
195
+ progress_cb: typing.Optional[collections.abc.Callable[..., typing.Any]] = None,
194
196
  ): ...
195
197
 
196
- add_local_dir: __add_local_dir_spec
198
+ add_local_dir: __add_local_dir_spec[typing_extensions.Self]
197
199
 
198
- class __listdir_spec(typing_extensions.Protocol):
200
+ class __listdir_spec(typing_extensions.Protocol[SUPERSELF]):
199
201
  def __call__(self, path: str) -> list[modal.volume.FileEntry]: ...
200
202
  async def aio(self, path: str) -> list[modal.volume.FileEntry]: ...
201
203
 
202
- listdir: __listdir_spec
204
+ listdir: __listdir_spec[typing_extensions.Self]
203
205
 
204
- class __remove_file_spec(typing_extensions.Protocol):
206
+ class __remove_file_spec(typing_extensions.Protocol[SUPERSELF]):
205
207
  def __call__(self, path: str, recursive=False): ...
206
208
  async def aio(self, path: str, recursive=False): ...
207
209
 
208
- remove_file: __remove_file_spec
210
+ remove_file: __remove_file_spec[typing_extensions.Self]
modal/object.pyi CHANGED
@@ -5,24 +5,28 @@ import modal.client
5
5
  import typing
6
6
  import typing_extensions
7
7
 
8
+ SUPERSELF = typing.TypeVar("SUPERSELF", covariant=True)
9
+
8
10
  class Object:
9
11
  _type_prefix: typing.ClassVar[typing.Optional[str]]
10
12
  _prefix_to_type: typing.ClassVar[dict[str, type]]
11
13
  _load: typing.Optional[
12
- typing.Callable[
14
+ collections.abc.Callable[
13
15
  [typing_extensions.Self, modal._resolver.Resolver, typing.Optional[str]], collections.abc.Awaitable[None]
14
16
  ]
15
17
  ]
16
18
  _preload: typing.Optional[
17
- typing.Callable[
19
+ collections.abc.Callable[
18
20
  [typing_extensions.Self, modal._resolver.Resolver, typing.Optional[str]], collections.abc.Awaitable[None]
19
21
  ]
20
22
  ]
21
23
  _rep: str
22
24
  _is_another_app: bool
23
25
  _hydrate_lazily: bool
24
- _deps: typing.Optional[typing.Callable[..., collections.abc.Sequence[Object]]]
25
- _deduplication_key: typing.Optional[typing.Callable[[], collections.abc.Awaitable[collections.abc.Hashable]]]
26
+ _deps: typing.Optional[collections.abc.Callable[..., collections.abc.Sequence[Object]]]
27
+ _deduplication_key: typing.Optional[
28
+ collections.abc.Callable[[], collections.abc.Awaitable[collections.abc.Hashable]]
29
+ ]
26
30
  _object_id: typing.Optional[str]
27
31
  _client: typing.Optional[modal.client.Client]
28
32
  _is_hydrated: bool
@@ -32,45 +36,43 @@ class Object:
32
36
  @classmethod
33
37
  def __init_subclass__(cls, type_prefix: typing.Optional[str] = None): ...
34
38
 
35
- class ___init_spec(typing_extensions.Protocol):
39
+ class ___init_spec(typing_extensions.Protocol[SUPERSELF]):
36
40
  def __call__(
37
41
  self,
38
42
  rep: str,
39
43
  load: typing.Optional[
40
- typing.Callable[[typing_extensions.Self, modal._resolver.Resolver, typing.Optional[str]], None]
44
+ collections.abc.Callable[[SUPERSELF, modal._resolver.Resolver, typing.Optional[str]], None]
41
45
  ] = None,
42
46
  is_another_app: bool = False,
43
47
  preload: typing.Optional[
44
- typing.Callable[[typing_extensions.Self, modal._resolver.Resolver, typing.Optional[str]], None]
48
+ collections.abc.Callable[[SUPERSELF, modal._resolver.Resolver, typing.Optional[str]], None]
45
49
  ] = None,
46
50
  hydrate_lazily: bool = False,
47
- deps: typing.Optional[typing.Callable[..., collections.abc.Sequence[Object]]] = None,
48
- deduplication_key: typing.Optional[typing.Callable[[], collections.abc.Hashable]] = None,
51
+ deps: typing.Optional[collections.abc.Callable[..., collections.abc.Sequence[Object]]] = None,
52
+ deduplication_key: typing.Optional[collections.abc.Callable[[], collections.abc.Hashable]] = None,
49
53
  ): ...
50
54
  def aio(
51
55
  self,
52
56
  rep: str,
53
57
  load: typing.Optional[
54
- typing.Callable[
55
- [typing_extensions.Self, modal._resolver.Resolver, typing.Optional[str]],
56
- collections.abc.Awaitable[None],
58
+ collections.abc.Callable[
59
+ [SUPERSELF, modal._resolver.Resolver, typing.Optional[str]], collections.abc.Awaitable[None]
57
60
  ]
58
61
  ] = None,
59
62
  is_another_app: bool = False,
60
63
  preload: typing.Optional[
61
- typing.Callable[
62
- [typing_extensions.Self, modal._resolver.Resolver, typing.Optional[str]],
63
- collections.abc.Awaitable[None],
64
+ collections.abc.Callable[
65
+ [SUPERSELF, modal._resolver.Resolver, typing.Optional[str]], collections.abc.Awaitable[None]
64
66
  ]
65
67
  ] = None,
66
68
  hydrate_lazily: bool = False,
67
- deps: typing.Optional[typing.Callable[..., collections.abc.Sequence[Object]]] = None,
69
+ deps: typing.Optional[collections.abc.Callable[..., collections.abc.Sequence[Object]]] = None,
68
70
  deduplication_key: typing.Optional[
69
- typing.Callable[[], collections.abc.Awaitable[collections.abc.Hashable]]
71
+ collections.abc.Callable[[], collections.abc.Awaitable[collections.abc.Hashable]]
70
72
  ] = None,
71
73
  ): ...
72
74
 
73
- _init: ___init_spec
75
+ _init: ___init_spec[typing_extensions.Self]
74
76
 
75
77
  def _unhydrate(self): ...
76
78
  def _initialize_from_empty(self): ...
@@ -85,15 +87,15 @@ class Object:
85
87
  @classmethod
86
88
  def _from_loader(
87
89
  cls,
88
- load: typing.Callable[[typing_extensions.Self, modal._resolver.Resolver, typing.Optional[str]], None],
90
+ load: collections.abc.Callable[[typing_extensions.Self, modal._resolver.Resolver, typing.Optional[str]], None],
89
91
  rep: str,
90
92
  is_another_app: bool = False,
91
93
  preload: typing.Optional[
92
- typing.Callable[[typing_extensions.Self, modal._resolver.Resolver, typing.Optional[str]], None]
94
+ collections.abc.Callable[[typing_extensions.Self, modal._resolver.Resolver, typing.Optional[str]], None]
93
95
  ] = None,
94
96
  hydrate_lazily: bool = False,
95
- deps: typing.Optional[typing.Callable[..., collections.abc.Sequence[Object]]] = None,
96
- deduplication_key: typing.Optional[typing.Callable[[], collections.abc.Hashable]] = None,
97
+ deps: typing.Optional[collections.abc.Callable[..., collections.abc.Sequence[Object]]] = None,
98
+ deduplication_key: typing.Optional[collections.abc.Callable[[], collections.abc.Hashable]] = None,
97
99
  ): ...
98
100
  @staticmethod
99
101
  def _get_type_from_id(object_id: str) -> type[Object]: ...
@@ -118,10 +120,16 @@ class Object:
118
120
  @property
119
121
  def is_hydrated(self) -> bool: ...
120
122
  @property
121
- def deps(self) -> typing.Callable[..., collections.abc.Sequence[Object]]: ...
123
+ def deps(self) -> collections.abc.Callable[..., collections.abc.Sequence[Object]]: ...
122
124
 
123
- class __resolve_spec(typing_extensions.Protocol):
125
+ class __resolve_spec(typing_extensions.Protocol[SUPERSELF]):
124
126
  def __call__(self, client: typing.Optional[modal.client.Client] = None): ...
125
127
  async def aio(self, client: typing.Optional[modal.client.Client] = None): ...
126
128
 
127
- resolve: __resolve_spec
129
+ resolve: __resolve_spec[typing_extensions.Self]
130
+
131
+ class __hydrate_spec(typing_extensions.Protocol[SUPERSELF]):
132
+ def __call__(self, client: typing.Optional[modal.client.Client] = None) -> SUPERSELF: ...
133
+ async def aio(self, client: typing.Optional[modal.client.Client] = None) -> SUPERSELF: ...
134
+
135
+ hydrate: __hydrate_spec[typing_extensions.Self]
modal/parallel_map.pyi CHANGED
@@ -1,3 +1,4 @@
1
+ import collections.abc
1
2
  import modal._utils.async_utils
2
3
  import modal.client
3
4
  import modal.functions
@@ -9,26 +10,28 @@ class _SynchronizedQueue:
9
10
  async def put(self, item): ...
10
11
  async def get(self): ...
11
12
 
13
+ SUPERSELF = typing.TypeVar("SUPERSELF", covariant=True)
14
+
12
15
  class SynchronizedQueue:
13
16
  def __init__(self, /, *args, **kwargs): ...
14
17
 
15
- class __init_spec(typing_extensions.Protocol):
18
+ class __init_spec(typing_extensions.Protocol[SUPERSELF]):
16
19
  def __call__(self): ...
17
20
  async def aio(self): ...
18
21
 
19
- init: __init_spec
22
+ init: __init_spec[typing_extensions.Self]
20
23
 
21
- class __put_spec(typing_extensions.Protocol):
24
+ class __put_spec(typing_extensions.Protocol[SUPERSELF]):
22
25
  def __call__(self, item): ...
23
26
  async def aio(self, item): ...
24
27
 
25
- put: __put_spec
28
+ put: __put_spec[typing_extensions.Self]
26
29
 
27
- class __get_spec(typing_extensions.Protocol):
30
+ class __get_spec(typing_extensions.Protocol[SUPERSELF]):
28
31
  def __call__(self): ...
29
32
  async def aio(self): ...
30
33
 
31
- get: __get_spec
34
+ get: __get_spec[typing_extensions.Self]
32
35
 
33
36
  class _OutputValue:
34
37
  value: typing.Any
@@ -43,7 +46,7 @@ def _map_invocation(
43
46
  client: modal.client._Client,
44
47
  order_outputs: bool,
45
48
  return_exceptions: bool,
46
- count_update_callback: typing.Optional[typing.Callable[[int, int], None]],
49
+ count_update_callback: typing.Optional[collections.abc.Callable[[int, int], None]],
47
50
  ): ...
48
51
  def _map_sync(
49
52
  self, *input_iterators, kwargs={}, order_outputs: bool = True, return_exceptions: bool = False