fix: use UTC import instead of datetime.UTC attribute#18
Conversation
`from datetime import datetime` makes `datetime` the class, not the module. `datetime.UTC` only exists on the module, causing `AttributeError` at runtime. Import `UTC` directly instead.
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 12 minutes and 18 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Summary
from datetime import datetimemakesdatetimethe class, not the moduledatetime.UTConly exists on the module level, causingAttributeError: type object 'datetime.datetime' has no attribute 'UTC'at runtimeUTCdirectly:from datetime import UTC, datetime, timedeltaDiscovered during v0.2.71 production deployment — collection runs were failing with this error.
Files changed
app/database.py— 6 occurrencesapp/main.py— 2 occurrencesTest plan
ruff checkpassespytest tests/test_auth.py— 15/15 passingpython3 -c "from datetime import UTC, datetime; datetime.now(UTC)"works