diff --git a/python-client/wmill/wmill/s3_reader.py b/python-client/wmill/wmill/s3_reader.py index 557bc9d200..6ff93db8ef 100644 --- a/python-client/wmill/wmill/s3_reader.py +++ b/python-client/wmill/wmill/s3_reader.py @@ -1,11 +1,11 @@ from io import BufferedReader, BytesIO -from json import JSONDecodeError +from typing import Optional, Union import httpx class S3BufferedReader(BufferedReader): - def __init__(self, workspace: str, windmill_client: httpx.Client, file_key: str, s3_resource_path: str | None, storage: str | None): + def __init__(self, workspace: str, windmill_client: httpx.Client, file_key: str, s3_resource_path: Optional[str], storage: Optional[str]): params = { "file_key": file_key, } @@ -61,7 +61,7 @@ class S3BufferedReader(BufferedReader): self._context_manager.__exit__(*args) -def bytes_generator(buffered_reader: BufferedReader | BytesIO): +def bytes_generator(buffered_reader: Union[BufferedReader, BytesIO]): while True: byte = buffered_reader.read(50 * 1024) if not byte: diff --git a/python-client/wmill/wmill/s3_types.py b/python-client/wmill/wmill/s3_types.py index b1736db9e9..5778eda021 100644 --- a/python-client/wmill/wmill/s3_types.py +++ b/python-client/wmill/wmill/s3_types.py @@ -1,7 +1,10 @@ +from typing import Optional + + class S3Object(dict): s3: str - storage: str | None - presigned: str | None + storage: Optional[str] + presigned: Optional[str] def __getattr__(self, attr): return self[attr]