Skip to content

Commit

Permalink
move to normal dict
Browse files Browse the repository at this point in the history
  • Loading branch information
msmitherdc authored Aug 29, 2024
1 parent 25ef445 commit a5590f6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions cloudpathlib/s3/s3client.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def __init__(
if k in self._extra_args
}

self._metadata_cache: MutableMapping[S3Path, PathMetadata] = WeakKeyDictionary()
self._metadata_cache: MutableMapping[S3Path, PathMetadata] = dict()

super().__init__(
local_cache_dir=local_cache_dir,
Expand Down Expand Up @@ -399,10 +399,10 @@ def _upload_file(self, local_path: Union[str, os.PathLike], cloud_path: S3Path)
return cloud_path

def _set_metadata_cache(self, cloud_path: S3Path, is_file_or_dir: Optional[str],
etag: Optional[str], size: Optional[int], lastmodified: Optional[str]) -> None:
etag: Optional[str], size: Optional[int], last_modified: Optional[str]) -> None:
if is_file_or_dir is None:
self._metadata_cache[cloud_path] = PathMetadata(is_file_or_dir=is_file_or_dir,
etag=etag, size=size, last_modified=lastmodified)
etag=etag, size=size, last_modified=last_modified)
# If a file/dir is now known to not exist, its parent directories may no longer exist
# either, since cloud directories only exist if they have a file in them. Since their
# state is no longer known we remove them from the cache.
Expand All @@ -411,7 +411,7 @@ def _set_metadata_cache(self, cloud_path: S3Path, is_file_or_dir: Optional[str],
del self._metadata_cache[parent]
else:
self._metadata_cache[cloud_path] = PathMetadata(is_file_or_dir=is_file_or_dir,
etag=etag, size=size, last_modified=lastmodified)
etag=etag, size=size, last_modified=last_modified)

def clear_metadata_cache(self) -> None:
self._metadata_cache.clear()
Expand Down

0 comments on commit a5590f6

Please sign in to comment.