|
11 | 11 | import sys |
12 | 12 | import tarfile |
13 | 13 | import tempfile |
| 14 | +from collections.abc import Generator |
14 | 15 | from io import BytesIO |
15 | 16 | from pathlib import Path |
16 | 17 | from textwrap import dedent |
17 | | -from typing import Any, Dict, Generator, List, Optional, Union |
| 18 | +from typing import Any, Optional, Union |
18 | 19 |
|
19 | 20 | from taskcluster.exceptions import TaskclusterRestFailure |
20 | 21 |
|
@@ -246,7 +247,7 @@ def build_image( |
246 | 247 |
|
247 | 248 | def load_image( |
248 | 249 | url: str, imageName: Optional[str] = None, imageTag: Optional[str] = None |
249 | | -) -> Dict[str, str]: |
| 250 | +) -> dict[str, str]: |
250 | 251 | """Load docker image from URL as imageName:tag. |
251 | 252 |
|
252 | 253 | Downloads a zstd-compressed docker image tarball from the given URL and |
@@ -286,7 +287,7 @@ def load_image( |
286 | 287 | else: |
287 | 288 | imageTag = "latest" |
288 | 289 |
|
289 | | - info: Dict[str, str] = {} |
| 290 | + info: dict[str, str] = {} |
290 | 291 |
|
291 | 292 | def download_and_modify_image() -> Generator[bytes, None, None]: |
292 | 293 | # This function downloads and edits the downloaded tar file on the fly. |
@@ -377,14 +378,14 @@ def download_and_modify_image() -> Generator[bytes, None, None]: |
377 | 378 | return info |
378 | 379 |
|
379 | 380 |
|
380 | | -def _index(l: List, s: str) -> Optional[int]: |
| 381 | +def _index(l: list, s: str) -> Optional[int]: |
381 | 382 | try: |
382 | 383 | return l.index(s) |
383 | 384 | except ValueError: |
384 | 385 | pass |
385 | 386 |
|
386 | 387 |
|
387 | | -def _resolve_image(image: Union[str, Dict[str, str]], graph_config: GraphConfig) -> str: |
| 388 | +def _resolve_image(image: Union[str, dict[str, str]], graph_config: GraphConfig) -> str: |
388 | 389 | image_task_id = None |
389 | 390 |
|
390 | 391 | # Standard case, image comes from the task definition. |
@@ -419,12 +420,12 @@ def _resolve_image(image: Union[str, Dict[str, str]], graph_config: GraphConfig) |
419 | 420 |
|
420 | 421 | def load_task( |
421 | 422 | graph_config: GraphConfig, |
422 | | - task: Union[str, Dict[str, Any]], |
| 423 | + task: Union[str, dict[str, Any]], |
423 | 424 | remove: bool = True, |
424 | 425 | user: Optional[str] = None, |
425 | 426 | custom_image: Optional[str] = None, |
426 | 427 | interactive: Optional[bool] = False, |
427 | | - volumes: Optional[Dict[str, str]] = None, |
| 428 | + volumes: Optional[dict[str, str]] = None, |
428 | 429 | ) -> int: |
429 | 430 | """Load and run a task interactively in a Docker container. |
430 | 431 |
|
|
0 commit comments