From ccd52b7acb8b8b189ba538fb156099d7b6931a8c Mon Sep 17 00:00:00 2001 From: Michael Milton Date: Wed, 21 Aug 2024 18:15:02 +1000 Subject: [PATCH] More type checking --- filesender/api.py | 4 ++-- filesender/log.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/filesender/api.py b/filesender/api.py index f640bcc..9af421d 100644 --- a/filesender/api.py +++ b/filesender/api.py @@ -1,4 +1,4 @@ -from typing import Any, Iterable, List, Optional, Tuple, AsyncIterator +from typing import Any, Iterable, List, Optional, Tuple, AsyncIterator, Union from filesender.download import files_from_page, DownloadFile import filesender.response_types as response import filesender.request_types as request @@ -366,7 +366,7 @@ async def download_file( token: str, file_id: int, out_dir: Path, - file_size: int | float = float("inf"), + file_size: Union[int, float] = float("inf"), file_name: Optional[str] = None ) -> None: """ diff --git a/filesender/log.py b/filesender/log.py index 589896e..e802529 100644 --- a/filesender/log.py +++ b/filesender/log.py @@ -24,6 +24,6 @@ def convert(self, value: Union[int, str], param: Union[Parameter, None], ctx: Un return LogLevel[value].value - def get_metavar(self, param: Parameter) -> str | None: + def get_metavar(self, param: Parameter) -> Union[str, None]: # Print out the choices return "|".join(LogLevel._member_map_)