From 1d5b5ced69975fc16ba6299c84faa145665e69b0 Mon Sep 17 00:00:00 2001 From: FayazRahman Date: Mon, 4 Dec 2023 15:44:15 +0530 Subject: [PATCH 1/2] fix --- deeplake/util/pretty_print.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deeplake/util/pretty_print.py b/deeplake/util/pretty_print.py index 4286d47ed9..33d93344b7 100644 --- a/deeplake/util/pretty_print.py +++ b/deeplake/util/pretty_print.py @@ -44,7 +44,7 @@ def summary_tensor(tensor): if tensor_compression == None: tensor_compression = "None" - if tensor.dtype == None: + if tensor.dtype is None: tensor_dtype = "None" else: tensor_dtype = tensor.dtype.name From 39ae042ed91b0ac3c5f93100d508d31ad4374b1d Mon Sep 17 00:00:00 2001 From: FayazRahman Date: Wed, 6 Dec 2023 13:39:28 +0530 Subject: [PATCH 2/2] fix --- deeplake/api/tests/test_api.py | 16 ++++++++-------- deeplake/util/pretty_print.py | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/deeplake/api/tests/test_api.py b/deeplake/api/tests/test_api.py index 87dee1b75c..190fb50b69 100644 --- a/deeplake/api/tests/test_api.py +++ b/deeplake/api/tests/test_api.py @@ -204,24 +204,24 @@ def test_stringify(memory_ds, capsys): ds.summary() assert ( 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" + == "Dataset(path='mem://hub_pytest/test_api/test_stringify', tensors=['image'])\n\n tensor htype shape dtype compression\n ------- ------- ------- ------- ------- \n image generic (4, 4) float64 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" + == "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) float64 None \n" ) ds.image.summary() assert ( capsys.readouterr().out - == "Tensor(key='image')\n\n htype shape dtype compression\n ------- ------- ------- ------- \n generic (4, 4) None None \n" + == "Tensor(key='image')\n\n htype shape dtype compression\n ------- ------- ------- ------- \n generic (4, 4) float64 None \n" ) ds[1:2].image.summary() assert ( capsys.readouterr().out - == "Tensor(key='image', index=Index([slice(1, 2, None)]))\n\n htype shape dtype compression\n ------- ------- ------- ------- \n generic (1, 4) None None \n" + == "Tensor(key='image', index=Index([slice(1, 2, None)]))\n\n htype shape dtype compression\n ------- ------- ------- ------- \n generic (1, 4) float64 None \n" ) @@ -233,11 +233,11 @@ def test_summary(memory_ds): assert ( summary_dataset(ds) - == "\n tensor htype shape dtype compression\n ------- ------- ------- ------- ------- \n abc generic (4, 4) None None \n images image (0,) int32 jpeg " + == "\n tensor htype shape dtype compression\n ------- ------- ------- ------- ------- \n abc generic (4, 4) float64 None \n images image (0,) int32 jpeg " ) assert ( summary_tensor(ds.abc) - == "\n htype shape dtype compression\n ------- ------- ------- ------- \n generic (4, 4) None None " + == "\n htype shape dtype compression\n ------- ------- ------- ------- \n generic (4, 4) float64 None " ) assert ( summary_tensor(ds.images) @@ -259,12 +259,12 @@ def test_view_summary(memory_ds, capsys): captured = capsys.readouterr().out assert ( captured - == f"{str(ds[2500:])}\n\n tensor htype shape dtype compression\n ------- ------- ------- ------- ------- \n abc generic (10000, 5, 5:10, 3) None None \n" + == f"{str(ds[2500:])}\n\n tensor htype shape dtype compression\n ------- ------- ------- ------- ------- \n abc generic (10000, 5, 5:10, 3) float64 None \n" ) assert ( summary_dataset(ds[:7500]) - == "\n tensor htype shape dtype compression\n ------- ------- ------- ------- ------- \n abc generic (7500, 5:10, 5, 3) None None " + == "\n tensor htype shape dtype compression\n ------- ------- ------- ------- ------- \n abc generic (7500, 5:10, 5, 3) float64 None " ) diff --git a/deeplake/util/pretty_print.py b/deeplake/util/pretty_print.py index 33d93344b7..298de6aa5d 100644 --- a/deeplake/util/pretty_print.py +++ b/deeplake/util/pretty_print.py @@ -93,7 +93,7 @@ def summary_dataset(dataset): if tensor_compression == None: tensor_compression = "None" - if tensor_object.dtype == None: + if tensor_object.dtype is None: tensor_dtype = "None" else: tensor_dtype = tensor_object.dtype.name