-
Notifications
You must be signed in to change notification settings - Fork 2.4k
feat: add exclude-newer to filter packages by publish date #10813
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
Open
satyamsoni2211
wants to merge
7
commits into
python-poetry:main
Choose a base branch
from
satyamsoni2211:feature/exclude_newer_flag
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
164d521
feat: add exclude-newer to filter packages by publish date
6507de8
feat: add exclude-newer to filter packages by publish date
91d183f
Merge branch 'worktree-feature_add_package_date_time' into feature/ex…
63978c1
fix: resolve mypy type errors in duration and provider modules
c9cccf5
Merge branch 'main' into feature/exclude_newer_flag
satyamsoni2211 c10c8f8
Fixed ruff formatting and linting
satyamsoni2211 56c0cc2
Fixing end of file for pyproject file
satyamsoni2211 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,3 +17,5 @@ | |
|
|
||
| .venv | ||
| /poetry.toml | ||
| /docs/superpowers/plans | ||
| /docs/superpowers/specs | ||
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
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
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| from __future__ import annotations | ||
|
|
||
| import re | ||
|
|
||
| from datetime import datetime | ||
| from datetime import timezone | ||
|
|
||
| import pytimeparse # type: ignore[import-untyped] | ||
|
|
||
| from dateutil.relativedelta import relativedelta # type: ignore[import-untyped] | ||
|
|
||
|
|
||
| def parse_duration(duration_str: str) -> datetime: | ||
| """ | ||
| Parse a human-readable duration string to a datetime. | ||
|
|
||
| Converts strings like "1 week", "3 days", "2 months" to a datetime | ||
| representing the cutoff point (current time minus the duration). | ||
|
|
||
| :param duration_str: A human-readable duration string (e.g., "1 week") | ||
| :return: A datetime object representing the cutoff time | ||
| :raises ValueError: If the duration string is invalid | ||
| """ | ||
| if not duration_str: | ||
| raise ValueError("Invalid duration: empty string") | ||
|
|
||
| # Handle month-based durations explicitly since pytimeparse doesn't support them | ||
| month_match = re.match(r"^(\d+)\s*months?$", duration_str.strip(), re.IGNORECASE) | ||
| if month_match: | ||
| months = int(month_match.group(1)) | ||
| now = datetime.now(timezone.utc) | ||
| return now - relativedelta(months=months) # type: ignore[no-any-return] | ||
|
|
||
| # pytimeparse returns seconds as an integer or None on failure | ||
| seconds = pytimeparse.parse(duration_str) | ||
|
|
||
| if seconds is None: | ||
| raise ValueError(f"Invalid duration: {duration_str!r}") | ||
|
|
||
| now = datetime.now(timezone.utc) | ||
| return now - relativedelta(seconds=seconds) # type: ignore[no-any-return] |
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion (typo): Clarify the parenthetical phrase to make the sentence grammatically complete.
The parenthetical "(assumed to be older)" reads as a fragment. Consider making it a complete clause, e.g. "…are included by default; they are assumed to be older" or "…, and are assumed to be older."
Suggested implementation: