1
1
import json
2
2
import logging
3
- from string import Template
4
3
import time
5
4
import warnings
6
5
from collections import namedtuple
7
6
from datetime import datetime , timezone
8
7
from pathlib import Path
8
+ from string import Template
9
9
from typing import (
10
10
TYPE_CHECKING ,
11
11
Any ,
14
14
List ,
15
15
Optional ,
16
16
Tuple ,
17
- TypeVar ,
18
17
Union ,
19
18
overload ,
20
19
)
21
20
from urllib .parse import urlparse
22
21
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
31
22
from labelbox import utils
32
- from labelbox .exceptions import error_message_for_unparsed_graphql_error
33
23
from labelbox .exceptions import (
34
24
InvalidQueryError ,
35
25
LabelboxError ,
36
26
ProcessingWaitTimeout ,
37
- ResourceConflict ,
38
27
ResourceNotFoundError ,
28
+ error_message_for_unparsed_graphql_error ,
39
29
)
40
30
from labelbox .orm import query
41
31
from labelbox .orm .db_object import DbObject , Deletable , Updateable , experimental
46
36
from labelbox .schema .data_row import DataRow
47
37
from labelbox .schema .export_filters import (
48
38
ProjectExportFilters ,
49
- validate_datetime ,
50
39
build_filters ,
51
40
)
52
41
from labelbox .schema .export_params import ProjectExportParams
53
42
from labelbox .schema .export_task import ExportTask
54
43
from labelbox .schema .id_type import IdType
55
44
from labelbox .schema .identifiable import DataRowIdentifier , GlobalKey , UniqueId
56
45
from 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
57
51
from labelbox .schema .media_type import MediaType
58
52
from 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
64
53
from labelbox .schema .ontology_kind import (
65
54
EditorTaskType ,
66
- OntologyKind ,
67
55
UploadType ,
68
56
)
57
+ from labelbox .schema .project_model_config import ProjectModelConfig
69
58
from labelbox .schema .project_overview import (
70
59
ProjectOverview ,
71
60
ProjectOverviewDetailed ,
72
61
)
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
73
66
74
67
if TYPE_CHECKING :
75
68
from labelbox import BulkImportRequest
@@ -579,7 +572,7 @@ def upsert_instructions(self, instructions_file: str) -> None:
579
572
580
573
if frontend .name != "Editor" :
581
574
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" ,
583
576
frontend .name ,
584
577
)
585
578
@@ -788,7 +781,9 @@ def create_batch(
788
781
if self .queue_mode != QueueMode .Batch :
789
782
raise ValueError ("Project must be in batch mode" )
790
783
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
792
787
raise ValueError (
793
788
"Cannot create batches for auto data generation projects"
794
789
)
@@ -814,7 +809,7 @@ def create_batch(
814
809
815
810
if row_count > 100_000 :
816
811
raise ValueError (
817
- f "Batch exceeds max size, break into smaller batches"
812
+ "Batch exceeds max size, break into smaller batches"
818
813
)
819
814
if not row_count :
820
815
raise ValueError ("You need at least one data row in a batch" )
@@ -1088,8 +1083,7 @@ def _create_batch_async(
1088
1083
task = self ._wait_for_task (task_id )
1089
1084
if task .status != "COMPLETE" :
1090
1085
raise LabelboxError (
1091
- f"Batch was not created successfully: "
1092
- + json .dumps (task .errors )
1086
+ "Batch was not created successfully: " + json .dumps (task .errors )
1093
1087
)
1094
1088
1095
1089
return self .client .get_batch (self .uid , batch_id )
@@ -1436,7 +1430,7 @@ def update_data_row_labeling_priority(
1436
1430
task = self ._wait_for_task (task_id )
1437
1431
if task .status != "COMPLETE" :
1438
1432
raise LabelboxError (
1439
- f "Priority was not updated successfully: "
1433
+ "Priority was not updated successfully: "
1440
1434
+ json .dumps (task .errors )
1441
1435
)
1442
1436
return True
@@ -1629,7 +1623,7 @@ def move_data_rows_to_task_queue(self, data_row_ids, task_queue_id: str):
1629
1623
task = self ._wait_for_task (task_id )
1630
1624
if task .status != "COMPLETE" :
1631
1625
raise LabelboxError (
1632
- f "Data rows were not moved successfully: "
1626
+ "Data rows were not moved successfully: "
1633
1627
+ json .dumps (task .errors )
1634
1628
)
1635
1629
0 commit comments