Skip to content

Commit edd7aed

Browse files
committed
naming convention for tests
1 parent 14566cf commit edd7aed

File tree

1 file changed

+19
-17
lines changed

1 file changed

+19
-17
lines changed

labelbox/schema/bulk_import_request.py

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
import requests
1212
from pydantic import BaseModel, validator
1313
from typing_extensions import Literal
14-
from typing import (Any, List, Optional, BinaryIO, Dict, Iterable, Tuple, Union,
15-
Type, Set)
14+
from typing import (Any, List, Optional, BinaryIO, Dict, Iterable, Tuple,
15+
Union, Type, Set)
1616

1717
import labelbox
1818
from labelbox import utils
@@ -79,13 +79,14 @@ def _send_create_file_command(
7979
response_data = response_json.get("data", None)
8080
if response_data is None:
8181
raise labelbox.exceptions.LabelboxError(
82-
"Failed to upload, message: %s" % response_json.get("errors", None))
82+
"Failed to upload, message: %s" %
83+
response_json.get("errors", None))
8384

8485
if not response_data.get("createBulkImportRequest", None):
8586
raise labelbox.exceptions.LabelboxError(
8687
"Failed to create BulkImportRequest, message: %s" %
87-
response_json.get("errors", None) or
88-
response_data.get("error", None))
88+
response_json.get("errors", None)
89+
or response_data.get("error", None))
8990

9091
return response_data
9192

@@ -393,9 +394,8 @@ def delete(self) -> None:
393394
None
394395
"""
395396
id_param = "bulk_request_id"
396-
query_str = """
397-
mutation DeleteBulkImportRequestPyApi($%s: ID!) {
398-
deleteBulkImportRequest (where: {id: $%s}) {
397+
query_str = """mutation deleteBulkImportRequestPyApi($%s: ID!) {
398+
deleteBulkImportRequest(where: {id: $%s}) {
399399
id
400400
name
401401
}
@@ -434,7 +434,8 @@ def _validate_ndjson(lines: Iterable[Dict[str, Any]],
434434
f'{uuid} already used in this import job, '
435435
'must be unique for the project.')
436436
uids.add(uuid)
437-
except (pydantic.ValidationError, ValueError, TypeError, KeyError) as e:
437+
except (pydantic.ValidationError, ValueError, TypeError,
438+
KeyError) as e:
438439
raise labelbox.exceptions.MALValidationError(
439440
f"Invalid NDJson on line {idx}") from e
440441

@@ -518,7 +519,6 @@ class VideoSupported(BaseModel):
518519
#Base class for a special kind of union.
519520
# Compatible with pydantic. Improves error messages over a traditional union
520521
class SpecialUnion:
521-
522522
def __new__(cls, **kwargs):
523523
return cls.build(kwargs)
524524

@@ -656,10 +656,11 @@ def validate_answers(cls, value, field):
656656

657657
def validate_feature_schemas(self, valid_feature_schemas):
658658
#Test top level feature schema for this tool
659-
super(NDChecklist, self).validate_feature_schemas(valid_feature_schemas)
659+
super(NDChecklist,
660+
self).validate_feature_schemas(valid_feature_schemas)
660661
#Test the feature schemas provided to the answer field
661-
if len(set([answer.schemaId for answer in self.answers])) != len(
662-
self.answers):
662+
if len(set([answer.schemaId
663+
for answer in self.answers])) != len(self.answers):
663664
raise ValueError(
664665
f"Duplicated featureSchema found for checklist {self.uuid}")
665666
for answer in self.answers:
@@ -728,7 +729,8 @@ class NDPolygon(NDBaseTool):
728729
def is_geom_valid(cls, v):
729730
if len(v) < 3:
730731
raise ValueError(
731-
f"A polygon must have at least 3 points to be valid. Found {v}")
732+
f"A polygon must have at least 3 points to be valid. Found {v}"
733+
)
732734
return v
733735

734736

@@ -800,7 +802,8 @@ def is_valid_mask(cls, v):
800802
#Does the dtype matter? Can it be a float?
801803
if not isinstance(colors, (tuple, list)):
802804
raise ValueError(
803-
f"Received color that is not a list or tuple. Found : {colors}")
805+
f"Received color that is not a list or tuple. Found : {colors}"
806+
)
804807
elif len(colors) != 3:
805808
raise ValueError(
806809
f"Must provide RGB values for segmentation colors. Found : {colors}"
@@ -816,15 +819,14 @@ class NDTool(
816819
SpecialUnion,
817820
Type[Union[NDMask, # type: ignore
818821
NDTextEntity, NDPoint, NDRectangle, NDPolyline,
819-
NDPolygon,]]):
822+
NDPolygon, ]]):
820823
...
821824

822825

823826
class NDAnnotation(
824827
SpecialUnion,
825828
Type[Union[NDTool, # type: ignore
826829
NDClassification]]):
827-
828830
@classmethod
829831
def build(cls: Any, data) -> "NDBase":
830832
if not isinstance(data, dict):

0 commit comments

Comments
 (0)