You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

s3path

Package Overview
Dependencies
Maintainers
1
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

s3path - pypi Package Compare versions

Comparing version
0.5.7
to
0.5.8
+1
-1
PKG-INFO
Metadata-Version: 2.1
Name: s3path
Version: 0.5.7
Version: 0.5.8
Home-page: https://github.com/liormizr/s3path

@@ -5,0 +5,0 @@ Author: Lior Mizrahi

Metadata-Version: 2.1
Name: s3path
Version: 0.5.7
Version: 0.5.8
Home-page: https://github.com/liormizr/s3path

@@ -5,0 +5,0 @@ Author: Lior Mizrahi

@@ -5,7 +5,8 @@ """

import sys
from pathlib import Path
from . import accessor
__version__ = '0.5.7'
__version__ = '0.5.8'
__all__ = (
'Path',
'register_configuration_parameter',

@@ -12,0 +13,0 @@ 'configuration_map',

@@ -407,4 +407,3 @@ import sys

query = _boto3_method_with_parameters(
resource.buckets.filter,
kwargs={'Prefix': str(self._path)},
resource.buckets.all,
config=config)

@@ -411,0 +410,0 @@ for bucket in query:

@@ -765,4 +765,7 @@ from __future__ import annotations

continue
if '*' == part:
new_regex_pattern += f'{self._path._flavour.sep}(?s:[^/]+)'
continue
new_regex_pattern += f'{self._path._flavour.sep}{fnmatch.translate(part)[:-2]}'
new_regex_pattern += r'/*\Z'
return re.compile(new_regex_pattern).fullmatch

@@ -59,3 +59,3 @@ """

def compile_pattern_parts(self, prefix, pattern, bucket):
def compile_pattern_parts(self, path, prefix, pattern, bucket):
pattern = self.sep.join((

@@ -76,4 +76,7 @@ '',

continue
if '*' == part:
new_regex_pattern += f'{path._flavour.sep}(?s:[^/]+)'
continue
new_regex_pattern += f'{self.sep}{fnmatch.translate(part)[:-2]}'
new_regex_pattern += '/*\Z'
new_regex_pattern += r'/*\Z'
return re.compile(new_regex_pattern).fullmatch

@@ -154,3 +157,3 @@

if not bucket_name:
for bucket in resource.buckets.filter(Prefix=str(self._path)):
for bucket in resource.buckets.all():
yield _S3DirEntry(bucket.name, is_dir=True)

@@ -713,3 +716,3 @@ return

self._target_level = self._calculate_pattern_level(pattern)
self.match = self._path._flavour.compile_pattern_parts(self._prefix, pattern, path.bucket)
self.match = self._path._flavour.compile_pattern_parts(self._path, self._prefix, pattern, path.bucket)

@@ -716,0 +719,0 @@ def select(self):

@@ -8,3 +8,3 @@ #!/usr/bin/env python

name='s3path',
version='0.5.7',
version='0.5.8',
url='https://github.com/liormizr/s3path',

@@ -11,0 +11,0 @@ author='Lior Mizrahi',

@@ -0,3 +1,3 @@

import shutil
import sys
import time
from datetime import timedelta

@@ -125,3 +125,3 @@ from pathlib import Path

def test_glog_nested_folders_issue_no_115(s3_mock):
def test_glob_nested_folders_issue_no_115(s3_mock):
s3 = boto3.resource('s3')

@@ -158,3 +158,3 @@ s3.create_bucket(Bucket='my-bucket')

def test_glog_nested_folders_issue_no_120(s3_mock):
def test_glob_nested_folders_issue_no_120(s3_mock):
s3 = boto3.resource('s3')

@@ -173,4 +173,4 @@ s3.create_bucket(Bucket='my-bucket')

def test_glog_nested_folders_issue_no_115_old_algo(s3_mock, enable_old_glob):
test_glog_nested_folders_issue_no_115(s3_mock)
def test_glob_nested_folders_issue_no_115_old_algo(s3_mock, enable_old_glob):
test_glob_nested_folders_issue_no_115(s3_mock)

@@ -235,2 +235,18 @@

def test_glob_nested_folders_issue_no_179(s3_mock):
s3 = boto3.resource('s3')
s3.create_bucket(Bucket='my-bucket')
example_paths = [
's3path/nested/further/andfurther/too_far_1.txt',
's3path/nested/further/andfurther/too_far_2.txt',
]
for example_path in example_paths:
object_summary = s3.ObjectSummary('my-bucket', f'{example_path}/test.txt')
object_summary.put(Body=b'test data')
path = S3Path.from_uri("s3://my-bucket/s3path/nested")
assert list(path.glob("*/*")) == [
S3Path('/my-bucket/s3path/nested/further/andfurther')]
def test_glob_issue_160_old_algo(s3_mock, enable_old_glob):

@@ -244,2 +260,6 @@ test_glob_issue_160(s3_mock)

def test_glob_nested_folders_issue_no_179_old_algo(s3_mock, enable_old_glob):
test_glob_nested_folders_issue_no_179(s3_mock)
def test_rglob(s3_mock):

@@ -881,1 +901,13 @@ s3 = boto3.resource('s3')

assert path.read_bytes() == file_contents_by_version[-1]
def test_buffered_copy(s3_mock):
s3 = boto3.resource('s3')
s3.create_bucket(Bucket='test-bucket')
data = b'test data' * 10_000_000
source_path = S3Path('/test-bucket/source')
source_path.write_bytes(data)
target_path = S3Path('/test-bucket/target')
with source_path.open('rb') as source, target_path.open('wb') as target:
shutil.copyfileobj(source, target)
assert target_path.read_bytes() == data