Skip to content

Commit e324353

Browse files
authored
Merge pull request #123 from Labelbox/jtso/ontology
fixed bug where IDs were defaulting to a list rather than None. also …
2 parents 0ee9e00 + cff3e15 commit e324353

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

labelbox/schema/ontology.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ def label(self):
4242
@classmethod
4343
def from_dict(cls, dictionary: Dict[str, Any]):
4444
return Option(value=dictionary["value"],
45-
schema_id=dictionary.get("schemaNodeId", []),
46-
feature_schema_id=dictionary.get("featureSchemaId", []),
45+
schema_id=dictionary.get("schemaNodeId", None),
46+
feature_schema_id=dictionary.get("featureSchemaId", None),
4747
options=[
4848
Classification.from_dict(o)
4949
for o in dictionary.get("options", [])
@@ -123,10 +123,10 @@ def from_dict(cls, dictionary: Dict[str, Any]):
123123
return Classification(
124124
class_type=Classification.Type(dictionary["type"]),
125125
instructions=dictionary["instructions"],
126-
required=dictionary["required"],
126+
required=dictionary.get("required", False),
127127
options=[Option.from_dict(o) for o in dictionary["options"]],
128-
schema_id=dictionary.get("schemaNodeId", []),
129-
feature_schema_id=dictionary.get("featureSchemaId", []))
128+
schema_id=dictionary.get("schemaNodeId", None),
129+
feature_schema_id=dictionary.get("featureSchemaId", None))
130130

131131
def asdict(self) -> Dict[str, Any]:
132132
if self.class_type in Classification._REQUIRES_OPTIONS \
@@ -201,9 +201,9 @@ class Type(Enum):
201201
@classmethod
202202
def from_dict(cls, dictionary: Dict[str, Any]):
203203
return Tool(name=dictionary['name'],
204-
schema_id=dictionary.get("schemaNodeId", []),
205-
feature_schema_id=dictionary.get("featureSchemaId", []),
206-
required=dictionary["required"],
204+
schema_id=dictionary.get("schemaNodeId", None),
205+
feature_schema_id=dictionary.get("featureSchemaId", None),
206+
required=dictionary.get("required", False),
207207
tool=Tool.Type(dictionary["tool"]),
208208
classifications=[
209209
Classification.from_dict(c)

0 commit comments

Comments
 (0)