Skip to content

Commit 9ff4c72

Browse files
author
Matt Sokoloff
committed
format
1 parent 196df8e commit 9ff4c72

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

labelbox/client.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -753,7 +753,11 @@ def get_feature_schema(self, feature_schema_id):
753753
query_str = """query rootSchemaNodePyApi($rootSchemaNodeWhere: RootSchemaNodeWhere!){
754754
rootSchemaNode(where: $rootSchemaNodeWhere){%s}
755755
}""" % query.results_query_part(Entity.FeatureSchema)
756-
res = self.execute(query_str, {'rootSchemaNodeWhere': {'featureSchemaId' : feature_schema_id}})['rootSchemaNode']
756+
res = self.execute(
757+
query_str,
758+
{'rootSchemaNodeWhere': {
759+
'featureSchemaId': feature_schema_id
760+
}})['rootSchemaNode']
757761
res['id'] = res['normalized']['featureSchemaId']
758762
return Entity.FeatureSchema(self, res)
759763

@@ -774,6 +778,7 @@ def get_feature_schemas(self, name_contains):
774778
}
775779
""" % query.results_query_part(Entity.FeatureSchema)
776780
params = {'search': name_contains, 'filter': {'status': 'ALL'}}
781+
777782
def rootSchemaPayloadToFeatureSchema(client, payload):
778783
# Technically we are querying for a Schema Node.
779784
# But the features are the same so we just grab the feature schema id
@@ -785,8 +790,7 @@ def rootSchemaPayloadToFeatureSchema(client, payload):
785790
rootSchemaPayloadToFeatureSchema,
786791
['rootSchemaNodes', 'nextCursor'])
787792

788-
def create_ontology_from_feature_schemas(self, name,
789-
feature_schema_ids):
793+
def create_ontology_from_feature_schemas(self, name, feature_schema_ids):
790794
"""
791795
Creates an ontology from a list of feature schema ids
792796
@@ -889,4 +893,3 @@ def create_feature_schema(self, normalized):
889893
# But the features are the same so we just grab the feature schema id
890894
res['id'] = res['normalized']['featureSchemaId']
891895
return Entity.FeatureSchema(self, res)
892-

labelbox/schema/ontology.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,6 @@ def from_dict(cls, dictionary: Dict[str, Any]):
136136
schema_id=dictionary.get("schemaNodeId", None),
137137
feature_schema_id=dictionary.get("featureSchemaId", None))
138138

139-
140139
def asdict(self) -> Dict[str, Any]:
141140
if self.class_type in self._REQUIRES_OPTIONS \
142141
and len(self.options) < 1:

tests/integration/test_ontology.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -271,9 +271,8 @@ def test_feature_schema_create_read(client, rand_gen):
271271

272272
time.sleep(3) # Slight delay for searching
273273
queried_feature_schemas = list(client.get_feature_schemas(name))
274-
assert [
275-
feature_schema.name for feature_schema in queried_feature_schemas
276-
] == [name]
274+
assert [feature_schema.name for feature_schema in queried_feature_schemas
275+
] == [name]
277276
queried_feature_schema = queried_feature_schemas[0]
278277

279278
for attr in Entity.FeatureSchema.fields():
@@ -291,8 +290,7 @@ def test_ontology_create_read(client, rand_gen):
291290
'color': 'black',
292291
'classifications': [],
293292
}
294-
feature_schema = client.create_feature_schema(
295-
feature_schema_cat_normalized)
293+
feature_schema = client.create_feature_schema(feature_schema_cat_normalized)
296294
created_ontology = client.create_ontology_from_feature_schemas(
297295
name=ontology_name, feature_schema_ids=[feature_schema.uid])
298296
tool_normalized = created_ontology.normalized['tools'][0]

0 commit comments

Comments
 (0)