Skip to content

Commit

Permalink
Formatting fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
nvoxland committed Apr 12, 2024
1 parent bfea813 commit 71fbed0
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 28 deletions.
8 changes: 6 additions & 2 deletions deeplake/core/meta/dataset_meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,18 @@ def __getstate__(self) -> Dict[str, Any]:
# return d

d = super().__getstate__()
d["tensors"] = list(filter(lambda x: (not x.startswith("__temp")), self.tensors))
d["tensors"] = list(
filter(lambda x: (not x.startswith("__temp")), self.tensors)
)
d["groups"] = self.groups.copy()

d["tensor_names"] = {
k: v for k, v in self.tensor_names.items() if not k.startswith("__temp")
}

d["hidden_tensors"] = list(filter(lambda x: (not x.startswith("__temp")), self.hidden_tensors))
d["hidden_tensors"] = list(
filter(lambda x: (not x.startswith("__temp")), self.hidden_tensors)
)
d["default_index"] = self.default_index.copy()
d["allow_delete"] = self._allow_delete
return d
Expand Down
3 changes: 2 additions & 1 deletion deeplake/core/storage/azure.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,8 @@ def _clear_impl(self, prefix=""):
self.check_readonly()
self._check_update_creds()
blobs = [
posixpath.join(self.root_folder, key) for key in self._all_keys_impl(prefix=prefix)
posixpath.join(self.root_folder, key)
for key in self._all_keys_impl(prefix=prefix)
]
# delete_blobs can only delete 256 blobs at a time
batches = [blobs[i : i + 256] for i in range(0, len(blobs), 256)]
Expand Down
6 changes: 0 additions & 6 deletions deeplake/core/storage/lru_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,6 @@ def _len_impl(self):
"""
return len(self._all_keys())


def _forward(self, path):
"""Forward the value at a given path to the next storage, and un-marks its key."""
if self.next_storage is not None:
Expand Down Expand Up @@ -447,11 +446,6 @@ def _insert_in_cache(self, path: str, value: Union[bytes, DeepLakeMemoryObject])
self.update_used_cache_for_path(path, _get_nbytes(value))

def _all_keys_impl(self, refresh: bool = False):
"""Helper function that lists all the objects present in the cache and the underlying storage.
Returns:
set: set of all the objects found in the cache and the underlying storage.
"""
key_set = set()
if self.next_storage is not None:
key_set = self.next_storage._all_keys() # type: ignore
Expand Down
20 changes: 1 addition & 19 deletions deeplake/core/storage/s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,6 @@ def _set(self, path, content):
)

def _setitem_impl(self, path, content):
"""
Raises:
S3SetError: Any S3 error encountered while setting the value at the path.
ReadOnlyError: If the provider is in read-only mode.
"""
self._check_update_creds()
path = "".join((self.path, path))
content = bytes(memoryview(content))
Expand Down Expand Up @@ -207,11 +202,6 @@ def _get(self, path, bucket=None):
return resp["Body"].read()

def _getitem_impl(self, path):
"""
Raises:
KeyError: If an object is not found at the path.
S3GetError: Any other error other than KeyError while retrieving the object.
"""
return self._get_bytes_impl(path)

def _get_bytes(
Expand Down Expand Up @@ -341,14 +331,6 @@ def _keys_iterator(self):
yield content["Key"]

def _all_keys_impl(self, refresh: bool = False):
"""Helper function that lists all the objects present at the root of the S3Provider.
Returns:
set: set of all the objects found at the root of the S3Provider.
Raises:
S3ListError: Any S3 error encountered while listing the objects.
"""
self._check_update_creds()

len_path = len(self.path.split("/")) - 1
Expand Down Expand Up @@ -445,7 +427,7 @@ def _state_keys(self):
"read_only",
"profile_name",
"creds_used",
"_temp_data"
"_temp_data",
}

def __getstate__(self):
Expand Down

0 comments on commit 71fbed0

Please sign in to comment.