-
Notifications
You must be signed in to change notification settings - Fork 68
[PTDT-1107] Implemented is_feature_schema_archived client function #927
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
labelbox/client.py
Outdated
| bool | ||
| """ | ||
|
|
||
| ontology_endpoint = self.rest_endpoint + "/ontologies/" + ontology_id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please encode ontology_id using urllib.parse.quote
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
labelbox/client.py
Outdated
| ontology_endpoint = self.rest_endpoint + "/ontologies/" + ontology_id | ||
| response = requests.get( | ||
| ontology_endpoint, | ||
| headers=self.rest_endpoint_headers, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| headers=self.rest_endpoint_headers, | |
| headers=self.headers, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
labelbox/client.py
Outdated
| headers=self.rest_endpoint_headers, | ||
| ) | ||
|
|
||
| if response.status_code == 200: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| if response.status_code == 200: | |
| if response.status_code == requests.codes.ok: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
kkim-labelbox
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left one comment, and please add a test case for the function, thanks!
labelbox/client.py
Outdated
| relationships = feature_schema_nodes['relationships'] | ||
| feature_schema_node_list = tools + classifications + relationships | ||
|
|
||
| is_feature = lambda f: f['featureSchemaId'] == feature_schema_id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be simplified to:
filtered_feature_schema_nodes = [feature_schema_node for feature_schema_node in feature_schema_node_list if feature_schema_node['featureSchemaId'] == feature_schema_id]
if filtered_feature_schema_nodes:
return bool(filtered_feature_schema_nodes[0]['archived']
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
kkim-labelbox
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM nice job!
kkim-labelbox
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually sorry, could you also add a case where is_feature_schema_archived is True?
NOTE: Requires PTDT-1107 to be merged first before this can be tested.
is_feature_schema_archived(feature_schema_node_id: str, ontology_id: str)0if the specified feature schema is not archived1if the specified feature schema is archvedHow to test:
Tool 1 - Bounding Box
Tool 2 - Bounding Box
SDK Test Code
Verify that the function returns
1for archived nodes, and0otherwise.https://www.loom.com/share/643245cb1bd441ccb64f5e0c44be8995