Jul 13 - Optimize code

This commit is contained in:
2026-07-13 16:52:00 -04:00
parent 936d860342
commit 00a9ba7770
27 changed files with 141 additions and 208 deletions
+14
View File
@@ -0,0 +1,14 @@
"""Time helpers.
`datetime.utcnow()` is deprecated on Python 3.12+. This helper preserves the
existing *naive UTC* semantics the codebase relies on (DB columns are naive
`DateTime`, and comparisons assume naive UTC) while avoiding the deprecation:
we build an aware UTC datetime and strip the tzinfo, yielding the exact same
value `datetime.utcnow()` used to return.
"""
from datetime import datetime, timezone
def utcnow() -> datetime:
"""Current UTC time as a naive datetime (tzinfo stripped)."""
return datetime.now(timezone.utc).replace(tzinfo=None)