11import json
22import logging
3- from string import Template
43import time
54import warnings
65from collections import namedtuple
76from datetime import datetime , timezone
87from pathlib import Path
8+ from string import Template
99from typing import (
1010 TYPE_CHECKING ,
1111 Any ,
1414 List ,
1515 Optional ,
1616 Tuple ,
17- TypeVar ,
1817 Union ,
1918 overload ,
2019)
2120from urllib .parse import urlparse
2221
23- from labelbox .schema .labeling_service import (
24- LabelingService ,
25- LabelingServiceStatus ,
26- )
27- from labelbox .schema .labeling_service_dashboard import LabelingServiceDashboard
28- import requests
29-
30- from labelbox import parser
3122from labelbox import utils
32- from labelbox .exceptions import error_message_for_unparsed_graphql_error
3323from labelbox .exceptions import (
3424 InvalidQueryError ,
3525 LabelboxError ,
3626 ProcessingWaitTimeout ,
37- ResourceConflict ,
3827 ResourceNotFoundError ,
28+ error_message_for_unparsed_graphql_error ,
3929)
4030from labelbox .orm import query
4131from labelbox .orm .db_object import DbObject , Deletable , Updateable , experimental
4636from labelbox .schema .data_row import DataRow
4737from labelbox .schema .export_filters import (
4838 ProjectExportFilters ,
49- validate_datetime ,
5039 build_filters ,
5140)
5241from labelbox .schema .export_params import ProjectExportParams
5342from labelbox .schema .export_task import ExportTask
5443from labelbox .schema .id_type import IdType
5544from labelbox .schema .identifiable import DataRowIdentifier , GlobalKey , UniqueId
5645from labelbox .schema .identifiables import DataRowIdentifiers , UniqueIds
46+ from labelbox .schema .labeling_service import (
47+ LabelingService ,
48+ LabelingServiceStatus ,
49+ )
50+ from labelbox .schema .labeling_service_dashboard import LabelingServiceDashboard
5751from labelbox .schema .media_type import MediaType
5852from labelbox .schema .model_config import ModelConfig
59- from labelbox .schema .project_model_config import ProjectModelConfig
60- from labelbox .schema .queue_mode import QueueMode
61- from labelbox .schema .resource_tag import ResourceTag
62- from labelbox .schema .task import Task
63- from labelbox .schema .task_queue import TaskQueue
6453from labelbox .schema .ontology_kind import (
6554 EditorTaskType ,
66- OntologyKind ,
6755 UploadType ,
6856)
57+ from labelbox .schema .project_model_config import ProjectModelConfig
6958from labelbox .schema .project_overview import (
7059 ProjectOverview ,
7160 ProjectOverviewDetailed ,
7261)
62+ from labelbox .schema .queue_mode import QueueMode
63+ from labelbox .schema .resource_tag import ResourceTag
64+ from labelbox .schema .task import Task
65+ from labelbox .schema .task_queue import TaskQueue
7366
7467if TYPE_CHECKING :
7568 from labelbox import BulkImportRequest
@@ -579,7 +572,7 @@ def upsert_instructions(self, instructions_file: str) -> None:
579572
580573 if frontend .name != "Editor" :
581574 logger .warning (
582- f "This function has only been tested to work with the Editor front end. Found %s" ,
575+ "This function has only been tested to work with the Editor front end. Found %s" ,
583576 frontend .name ,
584577 )
585578
@@ -788,7 +781,9 @@ def create_batch(
788781 if self .queue_mode != QueueMode .Batch :
789782 raise ValueError ("Project must be in batch mode" )
790783
791- if self .is_auto_data_generation ():
784+ if (
785+ self .is_auto_data_generation () and not self .is_chat_evaluation ()
786+ ): # NOTE live chat evaluatiuon projects in sdk do not pre-generate data rows, but use batch as all other projects
792787 raise ValueError (
793788 "Cannot create batches for auto data generation projects"
794789 )
@@ -814,7 +809,7 @@ def create_batch(
814809
815810 if row_count > 100_000 :
816811 raise ValueError (
817- f "Batch exceeds max size, break into smaller batches"
812+ "Batch exceeds max size, break into smaller batches"
818813 )
819814 if not row_count :
820815 raise ValueError ("You need at least one data row in a batch" )
@@ -1088,8 +1083,7 @@ def _create_batch_async(
10881083 task = self ._wait_for_task (task_id )
10891084 if task .status != "COMPLETE" :
10901085 raise LabelboxError (
1091- f"Batch was not created successfully: "
1092- + json .dumps (task .errors )
1086+ "Batch was not created successfully: " + json .dumps (task .errors )
10931087 )
10941088
10951089 return self .client .get_batch (self .uid , batch_id )
@@ -1436,7 +1430,7 @@ def update_data_row_labeling_priority(
14361430 task = self ._wait_for_task (task_id )
14371431 if task .status != "COMPLETE" :
14381432 raise LabelboxError (
1439- f "Priority was not updated successfully: "
1433+ "Priority was not updated successfully: "
14401434 + json .dumps (task .errors )
14411435 )
14421436 return True
@@ -1629,7 +1623,7 @@ def move_data_rows_to_task_queue(self, data_row_ids, task_queue_id: str):
16291623 task = self ._wait_for_task (task_id )
16301624 if task .status != "COMPLETE" :
16311625 raise LabelboxError (
1632- f "Data rows were not moved successfully: "
1626+ "Data rows were not moved successfully: "
16331627 + json .dumps (task .errors )
16341628 )
16351629
0 commit comments