Skip to content

Commit a4640bf

Browse files
committed
moved client method to the bottom of the file to avoid conflicts
1 parent b34b2d9 commit a4640bf

File tree

1 file changed

+29
-29
lines changed

1 file changed

+29
-29
lines changed

labelbox/client.py

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1578,35 +1578,6 @@ def get_catalog_slice(self, slice_id) -> CatalogSlice:
15781578
res = self.execute(query_str, {'id': slice_id})
15791579
return Entity.CatalogSlice(self, res['getSavedQuery'])
15801580

1581-
def unarchive_feature_schema_node(self, ontology_id: str,
1582-
root_feature_schema_id: str) -> bool:
1583-
"""
1584-
Returns true if the root feature schema node was successfully unarchived.
1585-
Only root level feature schema nodes can be unarchived.
1586-
Args:
1587-
root_feature_schema_id (str): The ID of the root level feature schema
1588-
ontology_id (str): The ID of the ontology
1589-
Returns:
1590-
bool
1591-
"""
1592-
ontology_endpoint = self.rest_endpoint + "/ontologies/" + urllib.parse.quote(
1593-
ontology_id) + '/feature-schemas/' + urllib.parse.quote(
1594-
root_feature_schema_id) + '/unarchive'
1595-
response = requests.patch(
1596-
ontology_endpoint,
1597-
headers=self.headers,
1598-
)
1599-
if response.status_code == requests.codes.ok:
1600-
unarchived = bool(response.json()['unarchived'])
1601-
if (unarchived == False):
1602-
raise labelbox.exceptions.LabelboxError(
1603-
"Failed unarchive the feature schema.")
1604-
return unarchived
1605-
else:
1606-
raise labelbox.exceptions.LabelboxError(
1607-
"Failed unarchive the feature schema node, message: ",
1608-
response.text)
1609-
16101581
def get_model_slice(self, slice_id) -> ModelSlice:
16111582
"""
16121583
Fetches a Model Slice by ID.
@@ -1675,3 +1646,32 @@ def delete_feature_schema_from_ontology(
16751646
raise labelbox.exceptions.LabelboxError(
16761647
"Failed to remove feature schema from ontology, message: " +
16771648
str(response.json()['message']))
1649+
1650+
def unarchive_feature_schema_node(self, ontology_id: str,
1651+
root_feature_schema_id: str) -> bool:
1652+
"""
1653+
Returns true if the root feature schema node was successfully unarchived.
1654+
Only root level feature schema nodes can be unarchived.
1655+
Args:
1656+
root_feature_schema_id (str): The ID of the root level feature schema
1657+
ontology_id (str): The ID of the ontology
1658+
Returns:
1659+
bool
1660+
"""
1661+
ontology_endpoint = self.rest_endpoint + "/ontologies/" + urllib.parse.quote(
1662+
ontology_id) + '/feature-schemas/' + urllib.parse.quote(
1663+
root_feature_schema_id) + '/unarchive'
1664+
response = requests.patch(
1665+
ontology_endpoint,
1666+
headers=self.headers,
1667+
)
1668+
if response.status_code == requests.codes.ok:
1669+
unarchived = bool(response.json()['unarchived'])
1670+
if (unarchived == False):
1671+
raise labelbox.exceptions.LabelboxError(
1672+
"Failed unarchive the feature schema.")
1673+
return unarchived
1674+
else:
1675+
raise labelbox.exceptions.LabelboxError(
1676+
"Failed unarchive the feature schema node, message: ",
1677+
response.text)

0 commit comments

Comments
 (0)