Plugin to check that utcnow() is not used in favour of now(UTC)
Project description
flake8_datetime_utcnow_plugin
Rationale
Plugin for flake8 to warn the developer of the usage of datetime.utcnow().
The problem with datetme.utcnow() is that indeed returns the current timestamp in the UTC timzone but the object is a naive datetime, that is doesn't have the tzinfo argument set.
Instead [datetime.now()](https://docs.python.org/3/library/datetime.html#datetime.datetime.utcnow] should be used passing the UTC timezone:
from datetime import datetime, timezone
datetime.now(timezone.utc)
Installation
To install the plugin and flake8:
pip install flake8_datetime_utcnow_plugin
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file flake8-datetime-utcnow-plugin-0.1.2.tar.gz.
File metadata
- Download URL: flake8-datetime-utcnow-plugin-0.1.2.tar.gz
- Upload date:
- Size: 3.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
724733581a7b4e08a089a738ee69f4ef0fa7450a6ba0e2d01e3367fcfa6b8a82
|
|
| MD5 |
6c854c9112c72a4035ee5654ffc31a7d
|
|
| BLAKE2b-256 |
b44116067fb6fde61aad561aecc31479514913c9691c9dd7d3f5d0ad9ce39799
|
File details
Details for the file flake8_datetime_utcnow_plugin-0.1.2-py3-none-any.whl.
File metadata
- Download URL: flake8_datetime_utcnow_plugin-0.1.2-py3-none-any.whl
- Upload date:
- Size: 4.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
91b60598643ec2d616949d60913a273b1e963b9eeaf46579bee442a2539640be
|
|
| MD5 |
ac9702a472b223956d0324ae66bf9b9f
|
|
| BLAKE2b-256 |
15e715070876d9d48870e1957f6cdc81771497ae1ef13f78a223eb43cff206a0
|