Skip to content

Commit

Permalink
Remove_S3DirEntry_from_public_api
Browse files Browse the repository at this point in the history
  • Loading branch information
liormizr committed Jun 26, 2023
1 parent 4978a92 commit 5ea0bd2
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions s3path.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
'S3Path',
'PureS3Path',
'StatResult',
'S3DirEntry',
)

ALLOWED_COPY_ARGS = TransferManager.ALLOWED_COPY_ARGS
Expand Down Expand Up @@ -144,7 +143,7 @@ def __iter__(self):
resource, _ = self._s3_accessor.configuration_map.get_configuration(self._path)
if not bucket_name:
for bucket in resource.buckets.filter(Prefix=str(self._path)):
yield S3DirEntry(bucket.name, is_dir=True)
yield _S3DirEntry(bucket.name, is_dir=True)
return
bucket = resource.Bucket(bucket_name)
sep = self._path._flavour.sep
Expand All @@ -162,12 +161,12 @@ def __iter__(self):
for folder in response.get('CommonPrefixes', ()):
full_name = folder['Prefix'][:-1] if folder['Prefix'].endswith(sep) else folder['Prefix']
name = full_name.split(sep)[-1]
yield S3DirEntry(name, is_dir=True)
yield _S3DirEntry(name, is_dir=True)
for file in response.get('Contents', ()):
if file['Key'] == response['Prefix']:
continue
name = file['Key'].split(sep)[-1]
yield S3DirEntry(name=name, is_dir=False, size=file['Size'], last_modified=file['LastModified'])
yield _S3DirEntry(name=name, is_dir=False, size=file['Size'], last_modified=file['LastModified'])
if not response.get('IsTruncated'):
break
continuation_token = response.get('NextContinuationToken')
Expand Down Expand Up @@ -1196,7 +1195,7 @@ def st_mtime(self):
return self.last_modified.timestamp()


class S3DirEntry:
class _S3DirEntry:
def __init__(self, name, is_dir, size=None, last_modified=None):
self.name = name
self._is_dir = is_dir
Expand Down

0 comments on commit 5ea0bd2

Please sign in to comment.