Skip to content

Commit cbc37d5

Browse files
authored
Merge pull request #201 from liormizr/features_version_064
Features version 064
2 parents 222e01e + 8fef45b commit cbc37d5

File tree

4 files changed

+12
-13
lines changed

4 files changed

+12
-13
lines changed

s3path/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from pathlib import Path
66
from . import accessor
77

8-
__version__ = '0.6.3'
8+
__version__ = '0.6.4'
99
__all__ = (
1010
'Path',
1111
'register_configuration_parameter',

s3path/current_version.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class PureS3Path(PurePath):
5050
"""
5151
PurePath subclass for AWS S3 service.
5252
53-
S3 is not a file-system but we can look at it like a POSIX system.
53+
S3 is not a file-system, but we can look at it like a POSIX system.
5454
"""
5555

5656
parser = _flavour = _S3Parser() # _flavour is not relevant after Python version 3.13
@@ -316,7 +316,7 @@ def owner(self, *, follow_symlinks: bool = False) -> str:
316316
raise KeyError('file not found')
317317
return accessor.owner(self)
318318

319-
def rename(self, target) -> S3Path:
319+
def rename(self, target) -> Self:
320320
"""
321321
Renames this file or Bucket / key prefix / key to the given target.
322322
If target exists and is a file, it will be replaced silently if the user has permission.
@@ -330,7 +330,7 @@ def rename(self, target) -> S3Path:
330330
accessor.rename(self, target)
331331
return type(self)(target)
332332

333-
def replace(self, target) -> S3Path:
333+
def replace(self, target) -> Self:
334334
"""
335335
Renames this Bucket / key prefix / key to the given target.
336336
If target points to an existing Bucket / key prefix / key, it will be unconditionally replaced.
@@ -435,7 +435,7 @@ def exists(self, *, follow_symlinks: bool = False) -> bool:
435435
return True
436436
return accessor.exists(self)
437437

438-
def iterdir(self) -> Generator['S3Path']:
438+
def iterdir(self) -> Generator[Self]:
439439
"""
440440
When the path points to a Bucket or a key prefix, yield path objects of the directory contents
441441
"""
@@ -470,7 +470,7 @@ def glob(
470470
self,
471471
pattern: str, *,
472472
case_sensitive: bool | None = None,
473-
recurse_symlinks: bool = False) -> Generator['S3Path']:
473+
recurse_symlinks: bool = False) -> Generator[Self]:
474474
"""
475475
Glob the given relative pattern in the Bucket / key prefix represented by this path,
476476
yielding all matching files (of any kind)
@@ -497,7 +497,7 @@ def rglob(
497497
self,
498498
pattern: str, *,
499499
case_sensitive: bool | None = None,
500-
recurse_symlinks: bool = False) -> Generator['S3Path']:
500+
recurse_symlinks: bool = False) -> Generator[Self]:
501501
"""
502502
This is like calling S3Path.glob with "**/" added in front of the given relative pattern
503503
@@ -593,7 +593,7 @@ def walk(
593593
self,
594594
top_down: bool = True,
595595
on_error:bool = None,
596-
follow_symlinks: bool = False) -> Generator[tuple['S3Path', list[str], list[str]]]:
596+
follow_symlinks: bool = False) -> Generator[tuple[Self, list[str], list[str]]]:
597597
if follow_symlinks:
598598
raise NotImplementedError(f'Setting follow_symlinks to {follow_symlinks} is unsupported on S3 service.')
599599

@@ -632,7 +632,7 @@ def __rtruediv__(self, key):
632632
return new_path
633633

634634
@classmethod
635-
def from_uri(cls, uri: str, *, version_id: str) -> PureVersionedS3Path:
635+
def from_uri(cls, uri: str, *, version_id: str) -> Self:
636636
"""
637637
from_uri class method creates a class instance from uri and version id
638638
@@ -645,7 +645,7 @@ def from_uri(cls, uri: str, *, version_id: str) -> PureVersionedS3Path:
645645
return cls(self, version_id=version_id)
646646

647647
@classmethod
648-
def from_bucket_key(cls, bucket: str, key: str, *, version_id: str) -> PureVersionedS3Path:
648+
def from_bucket_key(cls, bucket: str, key: str, *, version_id: str) -> Self:
649649
"""
650650
from_bucket_key class method creates a class instance from bucket, key and version id
651651
@@ -657,7 +657,7 @@ def from_bucket_key(cls, bucket: str, key: str, *, version_id: str) -> PureVersi
657657
self = PureS3Path.from_bucket_key(bucket=bucket, key=key)
658658
return cls(self, version_id=version_id)
659659

660-
def with_segments(self, *pathsegments) -> PureVersionedS3Path:
660+
def with_segments(self, *pathsegments) -> Self:
661661
"""Construct a new path object from any number of path-like objects.
662662
Subclasses may override this method to customize how new path objects
663663
are created from methods like `iterdir()`.

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
long_description = fh.read()
66
setup(
77
name='s3path',
8-
version='0.6.3',
8+
version='0.6.4',
99
url='https://github.com/liormizr/s3path',
1010
author='Lior Mizrahi',
1111
author_email='li.mizr@gmail.com',

tests/test_pure_path_operations.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import os
2-
import sys
32
import pytest
43
from pathlib import Path, PurePosixPath, PureWindowsPath
54
from s3path import PureS3Path

0 commit comments

Comments
 (0)