HomePhabricator

[Fix] datetime.utcnow() is deprecated; use Timestamp.nowutc() instead

Tags
None
Referenced Files
None
Subscribers
None

Description

[Fix] datetime.utcnow() is deprecated; use Timestamp.nowutc() instead

datetime.utcnow() is deprecated and datetime.now(datetime.UTC) should
be used instead:
https://docs.python.org/3.13/library/datetime.html#datetime.datetime.utcnow

  • add new Timestamp method 'nowutc' which is a shorthand for Timestamp.now(datetime.UTC)
  • override Timestamp.utcnow() to ignore deprecation warnings because this behaviour is needed until other methods like fromISOformat returns a timestamp with timezone.
  • replace all datetime.utcnow() with Timestamp.utcnow() to omit deprecation warnings.
  • replace datetime.utcnow() with Timestamp.nowutc() if appropriate e.g. for the CachedRequest timestamp.
  • rename the api cache from apicache-py3 to apicache. Otherwise a TypeErrror can happen when mixing offset-naive and offset-aware datetimes
  • update tests, remove Python related test
  • remove experimental flag in github actions for Python 3.12

Bug: T337748
Change-Id: Ibbae55a4459155ea0f71f2fc2a033f7e4b513419

Details

Provenance
XqtAuthored on Jun 5 2023, 1:19 PM
Parents
R3347:16f1b1272105: [tests] Skip tests on infogalactic.com
Branches
Unknown
Tags
Unknown
ChangeId
Ibbae55a4459155ea0f71f2fc2a033f7e4b513419

Event Timeline