Skip to content

Commit a333ed2

Browse files
author
Matt Sokoloff
committed
Merge branch 'develop' of https://github.com/Labelbox/labelbox-python into examples
2 parents 01052e3 + e324353 commit a333ed2

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

labelbox/client.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ def check_errors(keywords, *path):
161161
return error
162162
return None
163163

164-
if check_errors(["AUTHENTICATION_ERROR"], "extensions", "exception",
164+
if check_errors(["AUTHENTICATION_ERROR"], "extensions",
165165
"code") is not None:
166166
raise labelbox.exceptions.AuthenticationError("Invalid API key")
167167

@@ -173,6 +173,7 @@ def check_errors(keywords, *path):
173173

174174
validation_error = check_errors(["GRAPHQL_VALIDATION_FAILED"],
175175
"extensions", "code")
176+
176177
if validation_error is not None:
177178
message = validation_error["message"]
178179
if message == "Query complexity limit exceeded":
@@ -193,8 +194,7 @@ def check_errors(keywords, *path):
193194
raise labelbox.exceptions.ApiLimitError(response_msg)
194195

195196
resource_not_found_error = check_errors(["RESOURCE_NOT_FOUND"],
196-
"extensions", "exception",
197-
"code")
197+
"extensions", "code")
198198
if resource_not_found_error is not None:
199199
# Return None and let the caller methods raise an exception
200200
# as they already know which resource type and ID was requested

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)