Repository navigation
feat: adopt timezone-aware timestamps #67
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
nickbaxter18
wants to merge
2
commits into
main
Choose a base branch
from
codex/implement-google-news-drive-sync-project-pipeline-xuy9hr
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
2 commits
Select commit
Hold shift + click to select a range
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
Some comments aren't visible on the classic Files Changed page.
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 |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| [flake8] | ||
| max-line-length = 100 | ||
| extend-ignore = E203 |
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 |
|---|---|---|
|
|
@@ -8,6 +8,7 @@ | |
| import logging | ||
| import os | ||
| import time | ||
| from datetime import datetime, timezone | ||
| from pathlib import Path | ||
| from typing import Any, Callable, Iterable, Optional, TypeVar | ||
|
|
||
|
|
@@ -144,3 +145,9 @@ def decrypt(self, payload: bytes) -> bytes: | |
| if self._fernet is not None: | ||
| return self._fernet.decrypt(payload) | ||
| return _xor_bytes(payload, self._key) | ||
|
|
||
|
|
||
| def utcnow() -> datetime: | ||
| """Return a timezone-aware ``datetime`` in UTC.""" | ||
|
|
||
| return datetime.now(timezone.utc) | ||
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 |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| from datetime import datetime, timedelta | ||
| from datetime import datetime, timedelta, timezone | ||
|
|
||
| from src.cache import ArticleCache | ||
| from src.news_fetcher import NewsArticle | ||
|
|
@@ -31,7 +31,7 @@ def test_cache_prunes_expired_entries(tmp_path): | |
| old = make_article( | ||
| "https://example.com/old", | ||
| "Old", | ||
| published_at=datetime.utcnow() - timedelta(days=2), | ||
| published_at=datetime.now(timezone.utc) - timedelta(days=2), | ||
| ) | ||
| cache.record([old]) | ||
| cache.record([]) # trigger retention cleanup | ||
|
|
||
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.
Check notice
Code scanning / CodeQL
Statement has no effect Note
Copilot Autofix
AI about 1 year ago
To fix the issue, simply delete the extraneous line on line 14:
codex/implement-google-news-drive-sync-project-pipeline-xuy9hr. This line does not contribute any functionality or documentation and is, at best, a distraction and source of confusion. No imports or new definitions are needed, nor do surrounding lines require any alteration. Ensure that the code’s functional or logical behavior is not changed by this removal.