Add new filter: one_per#491
Open
kelbyers wants to merge 24 commits into
Open
Conversation
Implemented so far: - ignores symlinks - tracks seen files - periods: month, day, hour, minute, second - asserts on invalid period - gets period from a file's timestamp
- lastmodified timestamp comparisons - creation timestamp comparisions - reverse ordering for timestamp comparisons - add to `res.vars`
for more information, see https://pre-commit.ci
'path.stat().st_ctime' is only valid for the file creation timestamp on Windows. We can use 'read_created()' from the 'created' filter to ensure that we get the actual file creation time. Changing to this requires changes to test cases that care about the file creation time.
for more information, see https://pre-commit.ci
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change Summary
New Filter:
one_perThis adds a new filter:
one_per.OnePer is a filter that groups files by time period and selectively emits files based on a detection method. For each time period, it identifies one "canonical" file (the earliest, newest, first-seen, etc.) and returns
Trueonly for the "extra" files in that period. The canonical file for each period is available via{one_per.the_one}but is not emitted. This enables deduplication workflows like removing redundant backups while keeping one representative file per period.In simpler terms: It keeps one file per time period and marks all others as candidates for deletion/processing.
The periods used for grouping can be:
The method for choosing the one file can be:
The sort order can be reversed by prefixing "-"; e.g., "-lastmodified", "-name".
Updates to Workflow Actions
All workflow actions have been updated to the current versions.
actions/checkout@v7.0.0docker/login-action@v4.4.0docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302(v6.2.0)docker/build-push-action@v7.3.0actions/setup-python@v6.3.0astral-sh/setup-uv@v8.3.2Related issue number
There are no related issues, this is a new feature.
Checklist