Use backwards-compatible union type syntax in Python client (#6277)

This commit is contained in:
David P. Kleinschmidt
2025-07-25 11:25:08 -04:00
committed by GitHub
parent 471883e738
commit 0cc2abcd30
2 changed files with 8 additions and 5 deletions
+3 -3
View File
@@ -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:
+5 -2
View File
@@ -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]