Skip to content

Commit f54a675

Browse files
authored
[X-0] Formatting (#1057)
1 parent 13f6246 commit f54a675

File tree

8 files changed

+44
-29
lines changed

8 files changed

+44
-29
lines changed

.pre-commit-config.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
repos:
22
- repo: https://github.com/google/yapf
3-
rev: v0.31.0
3+
rev: v0.33.0
44
hooks:
55
- id: yapf
66
name: "yapf"
77
args: [-i, --style, google]
8-
- repo: https://github.com/datarootsio/databooks
9-
rev: 1.0.1
10-
hooks:
11-
- id: databooks-meta
12-
args: [examples, --overwrite]
8+
- repo: https://github.com/datarootsio/databooks
9+
rev: 1.0.1
10+
hooks:
11+
- id: databooks-meta
12+
args: [examples, --overwrite]

labelbox/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ def _create(self, db_object_type, data):
546546
# Also convert Labelbox object values to their UIDs.
547547
data = {
548548
db_object_type.attribute(attr) if isinstance(attr, str) else attr:
549-
value.uid if isinstance(value, DbObject) else value
549+
value.uid if isinstance(value, DbObject) else value
550550
for attr, value in data.items()
551551
}
552552

labelbox/data/serialization/labelbox_v1/objects.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,9 @@ def from_common(cls, mask: Mask,
225225
classifications=classifications,
226226
schema_id=feature_schema_id,
227227
title=title,
228-
**{k: v for k, v in extra.items() if k != 'instanceURI'})
228+
**{
229+
k: v for k, v in extra.items() if k != 'instanceURI'
230+
})
229231

230232

231233
class _TextPoint(BaseModel):
@@ -262,9 +264,18 @@ def from_common(cls, text_entity: TextEntity,
262264

263265

264266
class LBV1Objects(BaseModel):
265-
objects: List[Union[LBV1Line, LBV1Point, LBV1Polygon, LBV1Rectangle,
266-
LBV1TextEntity, LBV1Mask, LBV1TIPoint, LBV1TILine,
267-
LBV1TIPolygon, LBV1TIRectangle,]]
267+
objects: List[Union[
268+
LBV1Line,
269+
LBV1Point,
270+
LBV1Polygon,
271+
LBV1Rectangle,
272+
LBV1TextEntity,
273+
LBV1Mask,
274+
LBV1TIPoint,
275+
LBV1TILine,
276+
LBV1TIPolygon,
277+
LBV1TIRectangle,
278+
]]
268279

269280
def to_common(self) -> List[ObjectAnnotation]:
270281
objects = [

labelbox/data/serialization/ndjson/base.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,8 @@ class NDAnnotation(NDJsonBase):
4444

4545
@root_validator()
4646
def must_set_one(cls, values):
47-
if ('schema_id' not in values or
48-
values['schema_id'] is None) and ('name' not in values or
49-
values['name'] is None):
47+
if ('schema_id' not in values or values['schema_id']
48+
is None) and ('name' not in values or values['name'] is None):
5049
raise ValueError("Schema id or name are not set. Set either one.")
5150
return values
5251

labelbox/data/serialization/ndjson/classification.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,8 @@ class NDAnswer(ConfidenceMixin):
1919

2020
@root_validator()
2121
def must_set_one(cls, values):
22-
if ('schema_id' not in values or
23-
values['schema_id'] is None) and ('name' not in values or
24-
values['name'] is None):
22+
if ('schema_id' not in values or values['schema_id']
23+
is None) and ('name' not in values or values['name'] is None):
2524
raise ValueError("Schema id or name are not set. Set either one.")
2625
return values
2726

labelbox/schema/bulk_import_request.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -736,8 +736,8 @@ def validate_feature_schemas(self, valid_feature_schemas_by_id,
736736
#A union with custom construction logic to improve error messages
737737
class NDClassification(
738738
SpecialUnion,
739-
Type[Union[NDText, NDRadio, # type: ignore
740-
NDChecklist]]):
739+
Type[Union[ # type: ignore
740+
NDText, NDRadio, NDChecklist]]):
741741
...
742742

743743

@@ -900,16 +900,21 @@ class NDMask(NDBaseTool):
900900
#A union with custom construction logic to improve error messages
901901
class NDTool(
902902
SpecialUnion,
903-
Type[Union[NDMask, # type: ignore
904-
NDTextEntity, NDPoint, NDRectangle, NDPolyline,
905-
NDPolygon,]]):
903+
Type[Union[ # type: ignore
904+
NDMask,
905+
NDTextEntity,
906+
NDPoint,
907+
NDRectangle,
908+
NDPolyline,
909+
NDPolygon,
910+
]]):
906911
...
907912

908913

909914
class NDAnnotation(
910915
SpecialUnion,
911-
Type[Union[NDTool, # type: ignore
912-
NDClassification]]):
916+
Type[Union[ # type: ignore
917+
NDTool, NDClassification]]):
913918

914919
@classmethod
915920
def build(cls: Any, data) -> "NDBase":

labelbox/schema/organization.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,9 @@ def invite_limit(self) -> InviteLimit:
112112
"""query InvitesLimitPyApi($%s: ID!) {
113113
invitesLimit(where: {id: $%s}) { used limit remaining }
114114
}""" % (org_id_param, org_id_param), {org_id_param: self.uid})
115-
return InviteLimit(
116-
**{utils.snake_case(k): v for k, v in res['invitesLimit'].items()})
115+
return InviteLimit(**{
116+
utils.snake_case(k): v for k, v in res['invitesLimit'].items()
117+
})
117118

118119
def remove_user(self, user: "User") -> None:
119120
"""

labelbox/schema/project.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -699,9 +699,9 @@ def create_labeler_performance(client, result):
699699
# python isoformat doesn't accept Z as utc timezone
700700
result["lastActivityTime"] = datetime.fromisoformat(
701701
result["lastActivityTime"].replace('Z', '+00:00'))
702-
return LabelerPerformance(
703-
**
704-
{utils.snake_case(key): value for key, value in result.items()})
702+
return LabelerPerformance(**{
703+
utils.snake_case(key): value for key, value in result.items()
704+
})
705705

706706
return PaginatedCollection(self.client, query_str, {id_param: self.uid},
707707
["project", "labelerPerformance"],

0 commit comments

Comments
 (0)