From 312cad997779b3ac47fd57e59bdfa87412c43edc Mon Sep 17 00:00:00 2001 From: Nathan Voxland Date: Tue, 5 Sep 2023 10:18:35 -0500 Subject: [PATCH] Fix code formatting --- deeplake/api/tests/test_api.py | 4 +- deeplake/core/transform/transform.py | 2 +- deeplake/enterprise/test_pytorch.py | 37 +++++++---- deeplake/enterprise/test_tensorflow.py | 71 ++++++++------------- deeplake/integrations/tests/test_pytorch.py | 4 +- 5 files changed, 59 insertions(+), 59 deletions(-) diff --git a/deeplake/api/tests/test_api.py b/deeplake/api/tests/test_api.py index 95d28f0913..f5e8791cc4 100644 --- a/deeplake/api/tests/test_api.py +++ b/deeplake/api/tests/test_api.py @@ -1922,7 +1922,9 @@ def test_dataset_copy( [ ("local_ds_generator", "local_path", "hub_cloud_dev_token"), pytest.param( - "s3_ds_generator", "s3_path", "hub_cloud_dev_token", + "s3_ds_generator", + "s3_path", + "hub_cloud_dev_token", marks=pytest.mark.slow, ), pytest.param( diff --git a/deeplake/core/transform/transform.py b/deeplake/core/transform/transform.py index bd863077fa..81423b19d6 100644 --- a/deeplake/core/transform/transform.py +++ b/deeplake/core/transform/transform.py @@ -323,7 +323,7 @@ def my_fn(sample_in: Any, samples_out, my_arg0, my_arg1=0): index=index, sample=sample, samples_processed=samples_processed, - suggest=suggest, + suggest=suggest, ) from e finally: reload_and_rechunk( diff --git a/deeplake/enterprise/test_pytorch.py b/deeplake/enterprise/test_pytorch.py index 135af4a735..3a1fa0e0fe 100644 --- a/deeplake/enterprise/test_pytorch.py +++ b/deeplake/enterprise/test_pytorch.py @@ -81,8 +81,11 @@ def test_setting_woker_init_function(local_auth_ds): @pytest.mark.parametrize( "ds", [ - pytest.param("hub_cloud_ds", marks=[pytest.mark.slow, pytest.mark.skip("Causing lockups")]), - "local_auth_ds" + pytest.param( + "hub_cloud_ds", + marks=[pytest.mark.slow, pytest.mark.skip("Causing lockups")], + ), + "local_auth_ds", ], indirect=True, ) @@ -554,10 +557,13 @@ def test_rename(local_auth_ds): @requires_torch @requires_libdeeplake -@pytest.mark.parametrize("num_workers", [ - 0, - pytest.param(2, marks=pytest.mark.skip(reason="causing lockups")), -]) +@pytest.mark.parametrize( + "num_workers", + [ + 0, + pytest.param(2, marks=pytest.mark.skip(reason="causing lockups")), + ], +) @pytest.mark.slow @pytest.mark.flaky def test_indexes(local_auth_ds, num_workers): @@ -580,10 +586,13 @@ def test_indexes(local_auth_ds, num_workers): @requires_torch @requires_libdeeplake @pytest.mark.slow -@pytest.mark.parametrize("num_workers", [ - 0, - pytest.param(2, marks=pytest.mark.skip("causing lockups")), -]) +@pytest.mark.parametrize( + "num_workers", + [ + 0, + pytest.param(2, marks=pytest.mark.skip("causing lockups")), + ], +) @pytest.mark.flaky def test_indexes_transform(local_auth_ds, num_workers): shuffle = False @@ -611,7 +620,9 @@ def test_indexes_transform(local_auth_ds, num_workers): @requires_torch @requires_libdeeplake -@pytest.mark.parametrize("num_workers", [0, pytest.param(2, marks=pytest.mark.skip("causing lockups"))]) +@pytest.mark.parametrize( + "num_workers", [0, pytest.param(2, marks=pytest.mark.skip("causing lockups"))] +) @pytest.mark.slow @pytest.mark.flaky def test_indexes_transform_dict(local_auth_ds, num_workers): @@ -650,7 +661,9 @@ def test_indexes_transform_dict(local_auth_ds, num_workers): @requires_torch @requires_libdeeplake -@pytest.mark.parametrize("num_workers", [0, pytest.param(2, marks=pytest.mark.skip("causing lockups"))]) +@pytest.mark.parametrize( + "num_workers", [0, pytest.param(2, marks=pytest.mark.skip("causing lockups"))] +) @pytest.mark.slow @pytest.mark.flaky def test_indexes_tensors(local_auth_ds, num_workers): diff --git a/deeplake/enterprise/test_tensorflow.py b/deeplake/enterprise/test_tensorflow.py index 168dac178a..2becb9f9dd 100644 --- a/deeplake/enterprise/test_tensorflow.py +++ b/deeplake/enterprise/test_tensorflow.py @@ -62,9 +62,7 @@ def test_tensorflow_small(local_auth_ds): ds.create_tensor("image2", max_chunk_size=TF_TESTS_MAX_CHUNK_SIZE) ds.image2.extend(np.array([i * np.ones((12, 12)) for i in range(16)])) - if isinstance( - get_base_storage(ds.storage), (MemoryProvider, GCSProvider) - ): + if isinstance(get_base_storage(ds.storage), (MemoryProvider, GCSProvider)): with pytest.raises(ValueError): dl = ds.dataloader() return @@ -130,9 +128,7 @@ def test_tensorflow_transform(local_auth_ds): ds.create_tensor("image2", max_chunk_size=TF_TESTS_MAX_CHUNK_SIZE) ds.image2.extend(np.array([i * np.ones((12, 12)) for i in range(16)])) - if isinstance( - get_base_storage(ds.storage), (MemoryProvider, GCSProvider) - ): + if isinstance(get_base_storage(ds.storage), (MemoryProvider, GCSProvider)): with pytest.raises(ValueError): dl = ds.dataloader() return @@ -167,18 +163,12 @@ def test_tensorflow_transform_dict(local_auth_ds): ds.create_tensor("image3", max_chunk_size=TF_TESTS_MAX_CHUNK_SIZE) ds.image3.extend(np.array([i * np.ones((12, 12)) for i in range(16)])) - if isinstance( - get_base_storage(ds.storage), (MemoryProvider, GCSProvider) - ): + if isinstance(get_base_storage(ds.storage), (MemoryProvider, GCSProvider)): with pytest.raises(ValueError): dl = ds.dataloader() return - dl = ( - ds.dataloader() - .transform({"image": double, "image2": None}) - .tensorflow() - ) + dl = ds.dataloader().transform({"image": double, "image2": None}).tensorflow() assert len(dl.dataset) == 16 @@ -222,9 +212,7 @@ def test_tensorflow_with_compression(local_auth_ds: Dataset): images.extend(np.ones((16, 12, 12, 3), dtype="uint8")) labels.extend(np.ones((16, 1), dtype="uint32")) - if isinstance( - get_base_storage(ds.storage), (MemoryProvider, GCSProvider) - ): + if isinstance(get_base_storage(ds.storage), (MemoryProvider, GCSProvider)): with pytest.raises(ValueError): dl = ds.dataloader() return @@ -250,9 +238,7 @@ def test_custom_tensor_order(local_auth_ds): ds.create_tensor(t, max_chunk_size=TF_TESTS_MAX_CHUNK_SIZE) ds[t].extend(np.random.random((3, 4, 5))) - if isinstance( - get_base_storage(ds.storage), (MemoryProvider, GCSProvider) - ): + if isinstance(get_base_storage(ds.storage), (MemoryProvider, GCSProvider)): with pytest.raises(ValueError): dl = ds.dataloader() return @@ -260,9 +246,7 @@ def test_custom_tensor_order(local_auth_ds): with pytest.raises(TensorDoesNotExistError): dl = ds.dataloader().tensorflow(tensors=["c", "d", "e"]) - dl = ds.dataloader().tensorflow( - tensors=["c", "d", "a"], return_index=False - ) + dl = ds.dataloader().tensorflow(tensors=["c", "d", "a"], return_index=False) for i, batch in enumerate(dl): c1, d1, a1 = batch @@ -334,12 +318,8 @@ def test_groups(local_auth_ds, compressed_image_paths): img1 = deeplake.read(compressed_image_paths["jpeg"][0]) img2 = deeplake.read(compressed_image_paths["png"][0]) with local_auth_ds as ds: - ds.create_tensor( - "images/jpegs/cats", htype="image", sample_compression="jpeg" - ) - ds.create_tensor( - "images/pngs/flowers", htype="image", sample_compression="png" - ) + ds.create_tensor("images/jpegs/cats", htype="image", sample_compression="jpeg") + ds.create_tensor("images/pngs/flowers", htype="image", sample_compression="png") for _ in range(10): ds.images.jpegs.cats.append(img1) ds.images.pngs.flowers.append(img2) @@ -559,10 +539,13 @@ def test_rename(local_auth_ds): @requires_tensorflow @requires_libdeeplake -@pytest.mark.parametrize("num_workers", [ - 0, - pytest.param(2, marks=pytest.mark.skip("causing lockups")), -]) +@pytest.mark.parametrize( + "num_workers", + [ + 0, + pytest.param(2, marks=pytest.mark.skip("causing lockups")), + ], +) @pytest.mark.slow @pytest.mark.flaky def test_indexes(local_auth_ds, num_workers): @@ -573,9 +556,7 @@ def test_indexes(local_auth_ds, num_workers): ds.xyz.append(i * np.ones((2, 2))) ptds = ( - ds.dataloader() - .batch(4) - .tensorflow(num_workers=num_workers, return_index=True) + ds.dataloader().batch(4).tensorflow(num_workers=num_workers, return_index=True) ) if shuffle: ptds = ptds.shuffle() @@ -588,10 +569,13 @@ def test_indexes(local_auth_ds, num_workers): @requires_tensorflow @requires_libdeeplake -@pytest.mark.parametrize("num_workers", [ - 0, - pytest.param(2, marks=pytest.mark.skip("causing lockups")), -]) +@pytest.mark.parametrize( + "num_workers", + [ + 0, + pytest.param(2, marks=pytest.mark.skip("causing lockups")), + ], +) @pytest.mark.slow @pytest.mark.flaky def test_indexes_transform(local_auth_ds, num_workers): @@ -660,10 +644,9 @@ def test_indexes_transform_dict(local_auth_ds, num_workers): @requires_tensorflow @requires_libdeeplake -@pytest.mark.parametrize("num_workers", [ - 0, - pytest.param(2, marks=pytest.mark.skip("causing lockups")) -]) +@pytest.mark.parametrize( + "num_workers", [0, pytest.param(2, marks=pytest.mark.skip("causing lockups"))] +) @pytest.mark.slow @pytest.mark.flaky def test_indexes_tensors(local_auth_ds, num_workers): diff --git a/deeplake/integrations/tests/test_pytorch.py b/deeplake/integrations/tests/test_pytorch.py index 196ea511eb..bc74930f52 100644 --- a/deeplake/integrations/tests/test_pytorch.py +++ b/deeplake/integrations/tests/test_pytorch.py @@ -602,7 +602,9 @@ def test_pytorch_collate(local_ds, shuffle, buffer_size): @pytest.mark.slow @requires_torch -@pytest.mark.parametrize("shuffle", [True, pytest.param(False, marks=pytest.mark.skip("causing lockups"))]) +@pytest.mark.parametrize( + "shuffle", [True, pytest.param(False, marks=pytest.mark.skip("causing lockups"))] +) @pytest.mark.flaky def test_pytorch_transform_collate(local_ds, shuffle): local_ds.create_tensor("a")