Skip to main content

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] shoukd 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flake8_datetime_utcnow_plugin-0.1.1.tar.gz (2.5 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file flake8_datetime_utcnow_plugin-0.1.1.tar.gz.

File metadata

  • Download URL: flake8_datetime_utcnow_plugin-0.1.1.tar.gz
  • Upload date:
  • Size: 2.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.7.1

File hashes

Hashes for flake8_datetime_utcnow_plugin-0.1.1.tar.gz
Algorithm Hash digest
SHA256 3cf177746a5043b607a64d232ca20a4f59394ce4c9b9557b5a0191410435f3b6
MD5 adc69477d25b39633a57413a0c1de222
BLAKE2b-256 55260dbda793344846100295463b5d9dc9f9a3c09b3e2886b7be4a0f186d2f79

See more details on using hashes here.

File details

Details for the file flake8_datetime_utcnow_plugin-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: flake8_datetime_utcnow_plugin-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.7.1

File hashes

Hashes for flake8_datetime_utcnow_plugin-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c6bf2b2eec3fe9a3590b4d126f04e69f4ae600df756acbb839cde3da9be3549e
MD5 53fad6ebecbc0ce8cdd8de4ecc8685de
BLAKE2b-256 89480f773a5fe012f6bc2f4c25db8878801252011dc1fdcf8b001aaa61e755ec

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page