Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify atomic_contents_add to accept a filter function #71

Merged
merged 7 commits into from
Jan 14, 2025

Conversation

emontnemery
Copy link
Contributor

@emontnemery emontnemery commented Jan 13, 2025

Modify atomic_contents_add to accept a filter function, for improved flexibility

The filter function is called once for each item, including the item passed to atomic_contents_add.

@@ -385,7 +385,7 @@ def _is_excluded_by_filter(path: PurePath, exclude_list: list[str]) -> bool:
"""Filter to filter excludes."""

for exclude in exclude_list:
if not path.match(exclude):
if not path.full_match(exclude):
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That not work as we work with PurePath (without any blocking stats). That is the nice thing on that function to keep it fast

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the full_match method with improved glob support was added in Python 3.13: https://docs.python.org/3/library/pathlib.html#pathlib.PurePath.full_match

@emontnemery emontnemery changed the title Use PurePath.full_match in file filter Modify atomic_contents_add to accept a filter function Jan 14, 2025
@agners agners added the breaking-change This change breaks the API of the library label Jan 14, 2025
securetar/__init__.py Outdated Show resolved Hide resolved
Co-authored-by: Stefan Agner <[email protected]>
@agners agners merged commit f113c50 into pvizeli:main Jan 14, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change This change breaks the API of the library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants