From 16148222262b50a3b5f7bfce5985a24612de6ba5 Mon Sep 17 00:00:00 2001 From: Eliot Lacroix <57907121+ellacroix@users.noreply.github.com> Date: Wed, 28 May 2025 17:04:41 +0200 Subject: [PATCH] Update client_ext.py Replaced | operator for union typing, which only works since Python 3.10, with Union[] typing. --- src/label_studio_sdk/projects/exports/client_ext.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/label_studio_sdk/projects/exports/client_ext.py b/src/label_studio_sdk/projects/exports/client_ext.py index 3ee9e7447..00260f576 100644 --- a/src/label_studio_sdk/projects/exports/client_ext.py +++ b/src/label_studio_sdk/projects/exports/client_ext.py @@ -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): @@ -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: @@ -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):