Skip to content

Commit

Permalink
Merge pull request #2257 from activeloopai/disable_view_summary
Browse files Browse the repository at this point in the history
Disabling summary for views
  • Loading branch information
istranic committed Mar 28, 2023
2 parents cd62bbe + e47d0e3 commit b2a8df2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
14 changes: 9 additions & 5 deletions deeplake/api/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,11 +207,15 @@ def test_stringify(memory_ds, capsys):
capsys.readouterr().out
== "Dataset(path='mem://hub_pytest/test_api/test_stringify', tensors=['image'])\n\n tensor htype shape dtype compression\n ------- ------- ------- ------- ------- \n image generic (4, 4) None None \n"
)
ds[1:2].summary()
assert (
capsys.readouterr().out
== "Dataset(path='mem://hub_pytest/test_api/test_stringify', index=Index([slice(1, 2, None)]), tensors=['image'])\n\n tensor htype shape dtype compression\n ------- ------- ------- ------- ------- \n image generic (1, 4) None None \n"
)
with pytest.raises(NotImplementedError):
ds[1:2].summary()
# TODO - Bring this back after summary is supported for views
# ds[1:2].summary()
# assert (
# capsys.readouterr().out
# == "Dataset(path='mem://hub_pytest/test_api/test_stringify', index=Index([slice(1, 2, None)]), tensors=['image'])\n\n tensor htype shape dtype compression\n ------- ------- ------- ------- ------- \n image generic (1, 4) None None \n"
# )

ds.image.summary()
assert (
capsys.readouterr().out
Expand Down
4 changes: 4 additions & 0 deletions deeplake/core/dataset/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -2214,6 +2214,10 @@ def delete(self, large_ok=False):

def summary(self):
"""Prints a summary of the dataset."""

if self.is_view:
raise NotImplementedError("Summary is not currently supported for views.")

pretty_print = summary_dataset(self)

print(self)
Expand Down

0 comments on commit b2a8df2

Please sign in to comment.