Skip to content

Commit

Permalink
Merge pull request OpenMined#9082 from OpenMined/hide_soft_deleted_da…
Browse files Browse the repository at this point in the history
…tasets

Exclude soft-deleted datasets from get_all results
  • Loading branch information
jcardonnet authored Jul 24, 2024
2 parents 5c8d3a3 + ccf200d commit b5d67f9
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions packages/syft/src/syft/service/dataset/dataset_stash.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# stdlib

# third party
from result import Err
from result import Ok
from result import Result

# relative
Expand Down Expand Up @@ -54,3 +56,18 @@ def search_action_ids(
) -> Result[list[Dataset], str]:
qks = QueryKeys(qks=[ActionIDsPartitionKey.with_obj(uid)])
return self.query_all(credentials=credentials, qks=qks)

def get_all(
self,
credentials: SyftVerifyKey,
order_by: PartitionKey | None = None,
has_permission: bool = False,
) -> Ok[list] | Err[str]:
result = super().get_all(credentials, order_by, has_permission)

if result.is_err():
return result
filtered_datasets = [
dataset for dataset in result.ok_value if not dataset.to_be_deleted
]
return Ok(filtered_datasets)

0 comments on commit b5d67f9

Please sign in to comment.