Skip to content

Commit

Permalink
refactor(client): hide function "deleteData" in fusion dataset
Browse files Browse the repository at this point in the history
PR Closed: #962
  • Loading branch information
rexzheng324-c committed Aug 23, 2021
1 parent ebeaa11 commit 3a2cd61
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions tensorbay/client/segment.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,22 +294,6 @@ def status(self) -> Status:
"""
return self._status

def delete_data(self, remote_path: str) -> None:
"""Delete data of a segment in a certain commit with the given remote paths.
Arguments:
remote_path: The remote path of data in a segment.
"""
self._status.check_authority_for_draft()
delete_data: Dict[str, Any] = {
"segmentName": self.name,
"remotePath": remote_path,
}
delete_data.update(self._status.get_status_info())

self._client.open_api_do("DELETE", "data", self._dataset_id, json=delete_data)


class SegmentClient(SegmentClientBase):
"""This class defines :class:`SegmentClient`.
Expand Down Expand Up @@ -643,6 +627,22 @@ def list_data(self) -> PagingList[RemoteData]:
lambda offset, limit: self._generate_data(url_getters, offset, limit), 128
)

def delete_data(self, remote_path: str) -> None:
"""Delete data of a segment in a certain commit with the given remote paths.
Arguments:
remote_path: The remote path of data in a segment.
"""
self._status.check_authority_for_draft()
delete_data: Dict[str, Any] = {
"segmentName": self.name,
"remotePath": remote_path,
}
delete_data.update(self._status.get_status_info())

self._client.open_api_do("DELETE", "data", self._dataset_id, json=delete_data)

def list_urls(self) -> PagingList[str]:
"""List the data urls in this segment.
Expand Down

0 comments on commit 3a2cd61

Please sign in to comment.