Skip to content

Commit 5f10b66

Browse files
committed
nit
1 parent 016898c commit 5f10b66

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

labelbox/schema/ontology.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ class Classification:
103103
schema_id: (str)
104104
feature_schema_id: (str)
105105
"""
106+
106107
class Type(Enum):
107108
TEXT = "text"
108109
CHECKLIST = "checklist"
@@ -124,13 +125,12 @@ def name(self):
124125

125126
@classmethod
126127
def from_dict(cls, dictionary: Dict[str, Any]):
127-
return cls(
128-
class_type=cls.Type(dictionary["type"]),
129-
instructions=dictionary["instructions"],
130-
required=dictionary.get("required", False),
131-
options=[Option.from_dict(o) for o in dictionary["options"]],
132-
schema_id=dictionary.get("schemaNodeId", None),
133-
feature_schema_id=dictionary.get("featureSchemaId", None))
128+
return cls(class_type=cls.Type(dictionary["type"]),
129+
instructions=dictionary["instructions"],
130+
required=dictionary.get("required", False),
131+
options=[Option.from_dict(o) for o in dictionary["options"]],
132+
schema_id=dictionary.get("schemaNodeId", None),
133+
feature_schema_id=dictionary.get("featureSchemaId", None))
134134

135135
def asdict(self) -> Dict[str, Any]:
136136
if self.class_type in self._REQUIRES_OPTIONS \
@@ -185,6 +185,7 @@ class Tool:
185185
schema_id: (str)
186186
feature_schema_id: (str)
187187
"""
188+
188189
class Type(Enum):
189190
POLYGON = "polygon"
190191
SEGMENTATION = "superpixel"
@@ -226,8 +227,8 @@ def asdict(self) -> Dict[str, Any]:
226227
}
227228

228229
def add_classification(self, classification: Classification):
229-
if classification.instructions in (c.instructions
230-
for c in self.classifications):
230+
if classification.instructions in (
231+
c.instructions for c in self.classifications):
231232
raise InconsistentOntologyException(
232233
f"Duplicate nested classification '{classification.instructions}' "
233234
f"for tool '{self.name}'")
@@ -348,8 +349,8 @@ def add_tool(self, tool: Tool):
348349
self.tools.append(tool)
349350

350351
def add_classification(self, classification: Classification):
351-
if classification.instructions in (c.instructions
352-
for c in self.classifications):
352+
if classification.instructions in (
353+
c.instructions for c in self.classifications):
353354
raise InconsistentOntologyException(
354355
f"Duplicate classification instructions '{classification.instructions}'. "
355356
)

0 commit comments

Comments
 (0)