Skip to content

Commit 0c75403

Browse files
author
Dmitriy Apollonin
committed
address code comments
1 parent b42493c commit 0c75403

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

labelbox/schema/annotation_import.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,14 +142,16 @@ def _create_from_bytes(cls, client, variables, query_str, file_name,
142142
return client.execute(data=data, files=files)
143143

144144
@classmethod
145-
def _get_ndjson_from_objects(cls, data, slug):
146-
if not isinstance(data, list):
145+
def _get_ndjson_from_objects(cls, objects: List[Dict[str, Any]],
146+
object_name: str) -> BinaryIO:
147+
if not isinstance(objects, list):
147148
raise TypeError(
148-
f"{slug} must be in a form of list. Found {type(data)}")
149+
f"{object_name} must be in a form of list. Found {type(objects)}"
150+
)
149151

150-
data_str = ndjson.dumps(data)
152+
data_str = ndjson.dumps(objects)
151153
if not data_str:
152-
raise ValueError(f"{slug} cannot be empty")
154+
raise ValueError(f"{object_name} cannot be empty")
153155

154156
return data_str.encode('utf-8')
155157

tests/unit/test_mal_import.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def test_should_warn_user_about_unsupported_confidence():
4343

4444

4545
def test_invalid_labels_format():
46-
"""this test should confirm that annotations are required to be in a form of dict"""
46+
"""this test should confirm that annotations are required to be in a form of list"""
4747
id = str(uuid.uuid4())
4848

4949
label = {

tests/unit/test_unit_label_import.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def test_should_warn_user_about_unsupported_confidence():
3737

3838

3939
def test_invalid_labels_format():
40-
"""this test should confirm that labels are required to be in a form of dict"""
40+
"""this test should confirm that labels are required to be in a form of list"""
4141
id = str(uuid.uuid4())
4242

4343
label = {

0 commit comments

Comments
 (0)