diff options
author | Dmitrii Agibov <dmitrii.agibov@arm.com> | 2022-09-08 14:24:39 +0100 |
---|---|---|
committer | Dmitrii Agibov <dmitrii.agibov@arm.com> | 2022-09-09 17:21:48 +0100 |
commit | f5b293d0927506c2a979a091bf0d07ecc78fa181 (patch) | |
tree | 4de585b7cb6ed34da8237063752270189a730a41 /src/mlia/utils/download.py | |
parent | cde0c6ee140bd108849bff40467d8f18ffc332ef (diff) | |
download | mlia-f5b293d0927506c2a979a091bf0d07ecc78fa181.tar.gz |
MLIA-386 Simplify typing in the source code
- Enable deferred annotations evaluation
- Use builtin types for type hints whenever possible
- Use | syntax for union types
- Rename mlia.core._typing into mlia.core.typing
Change-Id: I3f6ffc02fa069c589bdd9e8bddbccd504285427a
Diffstat (limited to 'src/mlia/utils/download.py')
-rw-r--r-- | src/mlia/utils/download.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/mlia/utils/download.py b/src/mlia/utils/download.py index 4658738..9ef2d9e 100644 --- a/src/mlia/utils/download.py +++ b/src/mlia/utils/download.py @@ -1,11 +1,11 @@ # SPDX-FileCopyrightText: Copyright 2022, Arm Limited and/or its affiliates. # SPDX-License-Identifier: Apache-2.0 """Utils for files downloading.""" +from __future__ import annotations + from dataclasses import dataclass from pathlib import Path from typing import Iterable -from typing import List -from typing import Optional import requests from rich.progress import BarColumn @@ -20,10 +20,10 @@ from mlia.utils.types import parse_int def download_progress( - content_chunks: Iterable[bytes], content_length: Optional[int], label: Optional[str] + content_chunks: Iterable[bytes], content_length: int | None, label: str | None ) -> Iterable[bytes]: """Show progress info while reading content.""" - columns: List[ProgressColumn] = [TextColumn("{task.description}")] + columns: list[ProgressColumn] = [TextColumn("{task.description}")] if content_length is None: total = float("inf") @@ -44,7 +44,7 @@ def download( url: str, dest: Path, show_progress: bool = False, - label: Optional[str] = None, + label: str | None = None, chunk_size: int = 8192, ) -> None: """Download the file.""" |