fix: replace deprecated datetime.utcnow() with timezone-aware alternative#2540
fix: replace deprecated datetime.utcnow() with timezone-aware alternative#2540nightcityblade wants to merge 2 commits intotopoteretes:devfrom
Conversation
…tive Replace remaining datetime.utcnow() calls with datetime.now(timezone.utc) across 4 files: - cognee/get_token.py (JWT expiry) - cognee/eval_framework/modal_run_eval.py (timestamp) - cognee/infrastructure/databases/cache/redis/RedisAdapter.py - cognee/infrastructure/databases/cache/fscache/FsCacheAdapter.py datetime.utcnow() is deprecated since Python 3.12 (PEP 587) and returns naive datetimes that can cause subtle timezone bugs.
Please make sure all the checkboxes are checked:
|
|
Hello @nightcityblade, thank you for submitting a PR! We will respond as soon as possible. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughReplaced timezone-naive Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@cognee/get_token.py`:
- Line 13: The file fails ruff formatting; run the formatter and commit the
result: execute `ruff format cognee/get_token.py` (and optionally `ruff check
cognee/get_token.py --line-length 100`) to fix formatting and import/style
issues in the token creation code (the dict containing the "exp" datetime), then
add and commit the reformatted file so the CI passes.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 0828fab1-797a-4910-9a2a-493dd7f1395a
📒 Files selected for processing (4)
cognee/eval_framework/modal_run_eval.pycognee/get_token.pycognee/infrastructure/databases/cache/fscache/FsCacheAdapter.pycognee/infrastructure/databases/cache/redis/RedisAdapter.py
Description
Replace remaining
datetime.utcnow()calls withdatetime.now(timezone.utc)across 4 files.datetime.utcnow()is deprecated since Python 3.12 and returns naive datetimes that can cause subtle timezone bugs.Files changed:
cognee/get_token.py— JWT expiry timestampcognee/eval_framework/modal_run_eval.py— eval timestampcognee/infrastructure/databases/cache/redis/RedisAdapter.py— cache entry timestampcognee/infrastructure/databases/cache/fscache/FsCacheAdapter.py— cache entry timestampAcceptance Criteria
utcnow()calls in the codebaseType of Change
Pre-submission Checklist
DCO Affirmation
I affirm that all code in every commit of this pull request conforms to the terms of the Topoteretes Developer Certificate of Origin.
Summary by CodeRabbit