platypush/platypush/utils
Fabio Manganiello c9a5c29a4a
🐛 A proper cross-version solution for the utcnow() issue.
No need to maintain two different pieces of logic - a `utcnow()` for
Python < 3.11 and `now(datetime.UTC)` for Python >= 3.11.

`datetime.timezone.utc` existed long before datetime.UTC and that's what
the `utcnow` facade should use.

This means that all the `utcnow()` will always have `tzinfo=UTC`
regardless of the Python version.

There's still a problem with the `utcnow()`-generated timestamps that
have been generated by previous versions of Python and stored on the db.

Therefore, when the code performs comparisons with timestamps fetched
from the db, it should always explicitly do a `.replace(tzinfo=utc)` to
ensure that we always compare offset-aware datetime representations.

See blog post for technical details:
https://manganiello.blog/wheres-my-time-again
2024-06-01 01:34:47 +02:00
..
mock Added dns to mocked modules. 2024-05-26 03:02:57 +02:00
__init__.py 🐛 A proper cross-version solution for the utcnow() issue. 2024-06-01 01:34:47 +02:00
manifest.py Replaced an old for ... in ... yield loop with yield from ... 2024-05-25 10:35:23 +02:00
media.py Enhanced get_default_media_plugin to filter by video/audio plugins. 2023-12-10 21:50:53 +01:00
ngrok.py Create application ngrok tunnel method moved to utils 2021-11-07 11:35:47 +01:00
threads.py Prevent a potential recursion error in wait_for_either. 2024-05-02 00:51:09 +00:00
workers.py Reimplemented workers as threads instead of processes 2019-12-29 23:18:58 +01:00