Skip to content

Commit f1633c0

Browse files
author
Val Brodsky
committed
YAPF
1 parent 303a3be commit f1633c0

File tree

3 files changed

+21
-18
lines changed

3 files changed

+21
-18
lines changed

labelbox/schema/model_run.py

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ class Status(Enum):
4848
FAILED = "FAILED"
4949

5050
def upsert_labels(self,
51-
label_ids: Optional[List[str]] = None,
52-
project_id: Optional[str] = None,
53-
timeout_seconds=3600):
51+
label_ids: Optional[List[str]] = None,
52+
project_id: Optional[str] = None,
53+
timeout_seconds=3600):
5454
""" Adds data rows and labels to a Model Run
5555
Args:
5656
label_ids (list): label ids to insert
@@ -64,21 +64,20 @@ def upsert_labels(self,
6464
use_project_id = project_id is not None
6565

6666
if not use_label_ids and not use_project_id:
67-
raise ValueError("Must provide at least one label id or a project id")
67+
raise ValueError(
68+
"Must provide at least one label id or a project id")
6869

6970
if use_label_ids and use_project_id:
7071
raise ValueError("Must only one of label ids, project id")
7172

7273
if use_label_ids:
7374
return self._upsert_labels_by_label_ids(label_ids)
74-
else: # use_project_id
75+
else: # use_project_id
7576
return self._upsert_labels_by_project_id(project_id)
7677

77-
78-
7978
def _upsert_labels_by_label_ids(self,
80-
label_ids: List[str],
81-
timeout_seconds=3600):
79+
label_ids: List[str],
80+
timeout_seconds=3600):
8281
mutation_name = 'createMEAModelRunLabelRegistrationTask'
8382
create_task_query_str = """mutation createMEAModelRunLabelRegistrationTaskPyApi($modelRunId: ID!, $labelIds : [ID!]!) {
8483
%s(where : { id : $modelRunId}, data : {labelIds: $labelIds})}
@@ -98,11 +97,11 @@ def _upsert_labels_by_label_ids(self,
9897
status_query_str, {'where': {
9998
'id': task_id
10099
}})['MEALabelRegistrationTaskStatus'],
101-
timeout_seconds=timeout_seconds)
100+
timeout_seconds=timeout_seconds)
102101

103102
def _upsert_labels_by_project_id(self,
104-
project_id: str,
105-
timeout_seconds=3600):
103+
project_id: str,
104+
timeout_seconds=3600):
106105
mutation_name = 'createMEAModelRunProjectLabelRegistrationTask'
107106
create_task_query_str = """mutation createMEAModelRunProjectLabelRegistrationTaskPyApi($modelRunId: ID!, $projectId : ID!) {
108107
%s(where : { modelRunId : $modelRunId, projectId: $projectId})}
@@ -122,8 +121,7 @@ def _upsert_labels_by_project_id(self,
122121
status_query_str, {'where': {
123122
'id': task_id
124123
}})['MEALabelRegistrationTaskStatus'],
125-
timeout_seconds=timeout_seconds)
126-
124+
timeout_seconds=timeout_seconds)
127125

128126
def upsert_data_rows(self,
129127
data_row_ids=None,

tests/integration/annotation_import/conftest.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,9 +439,11 @@ def model_run_with_model_run_data_rows(client, configured_project,
439439
model_run.delete()
440440
# TODO: Delete resources when that is possible ..
441441

442+
442443
@pytest.fixture
443444
def model_run_with_model_run_all_project_data_rows(client, configured_project,
444-
model_run_predictions, model_run):
445+
model_run_predictions,
446+
model_run):
445447
configured_project.enable_model_assisted_labeling()
446448

447449
upload_task = LabelImport.create_from_objects(
@@ -454,6 +456,7 @@ def model_run_with_model_run_all_project_data_rows(client, configured_project,
454456
model_run.delete()
455457
# TODO: Delete resources when that is possible ..
456458

459+
457460
class AnnotationImportTestHelpers:
458461

459462
@classmethod

tests/integration/annotation_import/test_mea_prediction_import.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,10 @@ def test_create_from_objects(model_run_with_model_run_data_rows,
3737
annotation_import.input_file_url, object_predictions)
3838
annotation_import.wait_until_done()
3939

40-
def test_create_from_objects_all_project_labels(model_run_with_model_run_all_project_data_rows,
41-
object_predictions,
42-
annotation_import_test_helpers):
40+
41+
def test_create_from_objects_all_project_labels(
42+
model_run_with_model_run_all_project_data_rows, object_predictions,
43+
annotation_import_test_helpers):
4344
name = str(uuid.uuid4())
4445

4546
annotation_import = model_run_with_model_run_all_project_data_rows.add_predictions(
@@ -51,6 +52,7 @@ def test_create_from_objects_all_project_labels(model_run_with_model_run_all_pro
5152
annotation_import.input_file_url, object_predictions)
5253
annotation_import.wait_until_done()
5354

55+
5456
def test_create_from_label_objects(model_run_with_model_run_data_rows,
5557
object_predictions,
5658
annotation_import_test_helpers):

0 commit comments

Comments
 (0)