From 687e63b871f10481db9a209b09d438239afed273 Mon Sep 17 00:00:00 2001 From: Michal Noszczak Date: Thu, 4 Apr 2024 10:44:54 +0000 Subject: [PATCH 1/5] Revert "Revert "Fix Exports V2 streamable interface for latin characters"" This reverts commit 54f9ad29c11f35896ccf844caee9cfdd3b3b18d4. --- labelbox/schema/export_task.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/labelbox/schema/export_task.py b/labelbox/schema/export_task.py index fa84456aa..f218cfe3d 100644 --- a/labelbox/schema/export_task.py +++ b/labelbox/schema/export_task.py @@ -223,10 +223,10 @@ def _get_file_content( response = requests.get(file_info.file, timeout=30) response.raise_for_status() assert len( - response.text + response.content ) == file_info.offsets.end - file_info.offsets.start + 1, ( f"expected {file_info.offsets.end - file_info.offsets.start + 1} bytes, " - f"got {len(response.text)} bytes") + f"got {len(response.content)} bytes") return file_info, response.text From 78e67bc162382e77bc5dca22f25024d58f34149f Mon Sep 17 00:00:00 2001 From: Michal Noszczak Date: Thu, 4 Apr 2024 11:34:51 +0000 Subject: [PATCH 2/5] Update tests --- tests/unit/conftest.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/unit/conftest.py b/tests/unit/conftest.py index 175f02355..fd3875277 100644 --- a/tests/unit/conftest.py +++ b/tests/unit/conftest.py @@ -123,6 +123,10 @@ def __init__(self, text: str, exception: Exception = None) -> None: @property def text(self): return self._text + + @property + def content(self): + return self._text def raise_for_status(self): if self._exception: From ddfe321e7770683bd4963abc0cd8696b91b80c67 Mon Sep 17 00:00:00 2001 From: Michal Noszczak Date: Thu, 4 Apr 2024 11:36:58 +0000 Subject: [PATCH 3/5] Linting --- tests/unit/conftest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/conftest.py b/tests/unit/conftest.py index fd3875277..0e8de8185 100644 --- a/tests/unit/conftest.py +++ b/tests/unit/conftest.py @@ -123,7 +123,7 @@ def __init__(self, text: str, exception: Exception = None) -> None: @property def text(self): return self._text - + @property def content(self): return self._text From c9729a73e64145a6d67d679d591ca9fdb1e14eeb Mon Sep 17 00:00:00 2001 From: Michal Noszczak Date: Thu, 4 Apr 2024 14:43:50 +0000 Subject: [PATCH 4/5] Return Errors URL None if has no errors --- labelbox/schema/export_task.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/labelbox/schema/export_task.py b/labelbox/schema/export_task.py index f218cfe3d..d4569cf1c 100644 --- a/labelbox/schema/export_task.py +++ b/labelbox/schema/export_task.py @@ -549,6 +549,8 @@ def errors_url(self): raise ExportTask.ExportTaskException( "This property is only available for export_v2 tasks due to compatibility reasons, please use streamable errors instead" ) + if not self.has_errors(): + return None base_url = self._task.client.rest_endpoint return base_url + '/export-errors/' + self._task.uid + '/' + self._task.client.get_organization( ).uid From c40f733a052af9cf96ccf411e6fc146c3c1952ed Mon Sep 17 00:00:00 2001 From: Michal Noszczak Date: Thu, 4 Apr 2024 14:48:54 +0000 Subject: [PATCH 5/5] Add errors_url, result_url, errors to __str__ --- labelbox/schema/export_task.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/labelbox/schema/export_task.py b/labelbox/schema/export_task.py index d4569cf1c..ad44e03ec 100644 --- a/labelbox/schema/export_task.py +++ b/labelbox/schema/export_task.py @@ -482,6 +482,9 @@ def __str__(self): "metadata", "name", "result", + "result_url", + "errors", + "errors_url", "status", "type", "uid",