Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/label_studio_sdk/projects/exports/client_ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from io import BytesIO
from label_studio_sdk.versions.client import VersionsClient, AsyncVersionsClient
from label_studio_sdk.core.api_error import ApiError
from typing import Union


class ExportTimeoutError(ApiError):
Expand Down Expand Up @@ -45,7 +46,7 @@ def _check_status(export_snapshot, converted_format_id, status):

class ExportsClientExt(ExportsClient):

def _bytestream_to_fileobj(self, bytestream: typing.Iterable[bytes] | bytes) -> typing.BinaryIO:
def _bytestream_to_fileobj(self, bytestream: Union[typing.Iterable[bytes], bytes]) -> typing.BinaryIO:
buffer = BytesIO()
if isinstance(bytestream, typing.Iterable):
for chunk in bytestream:
Expand Down Expand Up @@ -122,7 +123,7 @@ def as_pandas(self, project_id: int, timeout: int = 60, create_kwargs: typing.Op

class AsyncExportsClientExt(AsyncExportsClient):

async def _bytestream_to_fileobj(self, bytestream: typing.AsyncGenerator[bytes, None] | bytes):
async def _bytestream_to_fileobj(self, bytestream: Union[typing.AsyncGenerator[bytes, None], bytes]):
"""Convert bytestream to file-like object"""
fileobj = BytesIO()
if isinstance(bytestream, typing.AsyncGenerator):
Expand Down
Loading