view roundup/anypy/datetime_.py @ 7587:8f29e4ea05ce

fix: issue2551278 - datetime.datetime.utcnow deprecation. Replace calls with equivalent that produces timezone aware dates rather than naive dates. Also some flake8 fixes for test/rest_common.py.
author John Rouillard <rouilj@ieee.org>
date Tue, 25 Jul 2023 16:30:10 -0400
parents
children 6894f152d49a
line wrap: on
line source

# https://issues.roundup-tracker.org/issue2551278
# datetime.utcnow deprecated
try:
    from datetime import now, UTC

    def utcnow():
        return now(UTC)
except ImportError:
    import datetime

    def utcnow():
        return datetime.datetime.utcnow()

Roundup Issue Tracker: http://roundup-tracker.org/