Skip to content

Commit 5f4ca70

Browse files
committed
Simplified feature schema filtering logic
1 parent 2087c86 commit 5f4ca70

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

labelbox/client.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1600,12 +1600,13 @@ def is_feature_schema_archived(self, ontology_id: str,
16001600
classifications = feature_schema_nodes['classifications']
16011601
relationships = feature_schema_nodes['relationships']
16021602
feature_schema_node_list = tools + classifications + relationships
1603-
1604-
is_feature = lambda f: f['featureSchemaId'] == feature_schema_id
1605-
feature_schema_node = list(
1606-
filter(is_feature, feature_schema_node_list))
1607-
if len(feature_schema_node) > 0:
1608-
return bool(feature_schema_node[0]['archived'])
1603+
filtered_feature_schema_nodes = [
1604+
feature_schema_node
1605+
for feature_schema_node in feature_schema_node_list
1606+
if feature_schema_node['featureSchemaId'] == feature_schema_id
1607+
]
1608+
if filtered_feature_schema_nodes:
1609+
return bool(filtered_feature_schema_nodes[0]['archived'])
16091610
else:
16101611
raise labelbox.exceptions.LabelboxError(
16111612
"The specified feature schema was not in the ontology.")

0 commit comments

Comments
 (0)