|
6 | 6 | import logging |
7 | 7 | import warnings |
8 | 8 | from collections.abc import Callable |
| 9 | +from collections.abc import Collection |
9 | 10 | from collections.abc import Iterable |
10 | 11 | from collections.abc import Mapping |
11 | 12 | from functools import partial |
@@ -148,25 +149,25 @@ def __init__( |
148 | 149 | self._ps_store = ps_store |
149 | 150 | self._ps_threshold = ps_threshold |
150 | 151 |
|
151 | | - def map( # type: ignore[no-untyped-def] |
| 152 | + def map( |
152 | 153 | self, |
153 | | - func, |
154 | | - *iterables, |
155 | | - key=None, |
156 | | - workers=None, |
157 | | - retries=None, |
158 | | - resources=None, |
159 | | - priority=0, |
160 | | - allow_other_workers=False, |
161 | | - fifo_timeout='100 ms', |
162 | | - actor=False, |
163 | | - actors=False, |
164 | | - pure=True, |
165 | | - batch_size=None, |
| 154 | + func: Callable[..., T], |
| 155 | + *iterables: Collection, # type: ignore[type-arg] |
| 156 | + key: str | list[str] | None = None, |
| 157 | + workers: str | Iterable[str] | None = None, |
| 158 | + retries: int | None = None, |
| 159 | + resources: dict[str, Any] | None = None, |
| 160 | + priority: int = 0, |
| 161 | + allow_other_workers: bool = False, |
| 162 | + fifo_timeout: str = '100 ms', |
| 163 | + actor: bool = False, |
| 164 | + actors: bool = False, |
| 165 | + pure: bool = True, |
| 166 | + batch_size: int | None = None, |
166 | 167 | proxy_args: bool = True, |
167 | 168 | proxy_result: bool = True, |
168 | | - **kwargs, |
169 | | - ): |
| 169 | + **kwargs: Any, |
| 170 | + ) -> list[DaskDistributedFuture[T]]: |
170 | 171 | """Map a function on a sequence of arguments. |
171 | 172 |
|
172 | 173 | This has the same behavior as [`Client.map()`][distributed.Client.map] |
@@ -276,22 +277,23 @@ def map( # type: ignore[no-untyped-def] |
276 | 277 |
|
277 | 278 | def submit( # type: ignore[no-untyped-def] |
278 | 279 | self, |
279 | | - func, |
| 280 | + func: Callable[..., T], |
280 | 281 | *args, |
281 | | - key=None, |
282 | | - workers=None, |
283 | | - resources=None, |
284 | | - retries=None, |
285 | | - priority=0, |
286 | | - fifo_timeout='100 ms', |
287 | | - allow_other_workers=False, |
288 | | - actor=False, |
289 | | - actors=False, |
290 | | - pure=True, |
| 282 | + key: str | None = None, |
| 283 | + workers: str | Iterable[str] | None = None, |
| 284 | + retries: int | None = None, |
| 285 | + resources: dict[str, Any] | None = None, |
| 286 | + priority: int = 0, |
| 287 | + allow_other_workers: bool = False, |
| 288 | + fifo_timeout: str = '100 ms', |
| 289 | + actor: bool = False, |
| 290 | + actors: bool = False, |
| 291 | + pure: bool = True, |
| 292 | + batch_size: int | None = None, |
291 | 293 | proxy_args: bool = True, |
292 | 294 | proxy_result: bool = True, |
293 | | - **kwargs, |
294 | | - ): |
| 295 | + **kwargs: Any, |
| 296 | + ) -> DaskDistributedFuture[T]: |
295 | 297 | """Submit a function application to the scheduler. |
296 | 298 |
|
297 | 299 | This has the same behavior as |
@@ -375,7 +377,7 @@ def submit( # type: ignore[no-untyped-def] |
375 | 377 |
|
376 | 378 |
|
377 | 379 | def _evict_proxies_callback( |
378 | | - _future: DaskDistributedFuture, |
| 380 | + _future: DaskDistributedFuture[Any], |
379 | 381 | keys: Iterable[ConnectorKeyT], |
380 | 382 | store: Store[Any], |
381 | 383 | ) -> None: |
|
0 commit comments