Skip to content

Commit c8bf0ec

Browse files
rllinrllin
authored andcommitted
address comments
1 parent f4bc9bf commit c8bf0ec

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

labelbox/exceptions.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,3 +88,8 @@ class ApiLimitError(LabelboxError):
8888
class MalformedQueryException(Exception):
8989
""" Raised when the user submits a malformed query."""
9090
pass
91+
92+
93+
class UuidError(LabelboxError):
94+
""" Raised when there are repeat Uuid's in bulk import request."""
95+
pass

labelbox/schema/bulk_import_request.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -279,13 +279,6 @@ def create_from_local_file(cls,
279279
return cls(client, response_data["createBulkImportRequest"])
280280

281281

282-
class NdjsonError(Exception):
283-
pass
284-
285-
286-
class UuidError(NdjsonError):
287-
pass
288-
289282

290283
def _validate_ndjson(lines: Iterable[Dict[str, Any]]) -> None:
291284
"""Validate individual ndjson lines.
@@ -297,6 +290,7 @@ def _validate_ndjson(lines: Iterable[Dict[str, Any]]) -> None:
297290
for line in lines:
298291
uuid = line['uuid']
299292
if uuid in uuids:
300-
raise UuidError(f'{uuid} already used in this import job, '
301-
'must be unique for the project.')
302-
uuids.add(line['uuid'])
293+
raise labelbox.exceptions.UuidError(
294+
f'{uuid} already used in this import job, '
295+
'must be unique for the project.')
296+
uuids.add(uuid)

0 commit comments

Comments
 (0)