Skip to main content

A plugin for flake8 to ban the usage of unsafe naive datetime class.

Project description

# flake8-datetimez

A plugin for flake8 to ban the usage of unsafe naive datetime class.

## List of warnings

  • DTZ001 : The use of datetime.datetime() without tzinfo argument is not allowed.

  • DTZ002 : The use of datetime.datetime.today() is not allowed. Use datetime.datetime.now(tz=) instead.

  • DTZ003 : The use of datetime.datetime.utcnow() is not allowed. Use datetime.datetime.now(tz=) instead.

  • DTZ004 : The use of datetime.datetime.utcfromtimestamp() is not allowed. Use datetime.datetime.fromtimestamp(, tz=) instead.

  • DTZ005 : The use of datetime.datetime.now() without tz argument is not allowed.

  • DTZ006 : The use of datetime.datetime.fromtimestamp() without tz argument is not allowed.

  • DTZ007 : The use of datetime.datetime.strptime() must be followed by .replace(tzinfo=).

  • DTZ011 : The use of datetime.date.today() is not allowed. Use datetime.datetime.now(tz=).date() instead.

  • DTZ012 : The use of datetime.date.fromtimestamp() is not allowed. Use datetime.datetime.fromtimestamp(, tz=).date() instead.

## Install

Install with pip

` $ pip install flake8-datetimez `

## Requirements - Python 3.6 or above - flake8 3.0.0 or above

## License

MIT

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-datetimez-19.5.4.0.tar.gz (3.9 kB view details)

Uploaded Source

File details

Details for the file flake8-datetimez-19.5.4.0.tar.gz.

File metadata

  • Download URL: flake8-datetimez-19.5.4.0.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.1

File hashes

Hashes for flake8-datetimez-19.5.4.0.tar.gz
Algorithm Hash digest
SHA256 b929592691422f2f04fc69562009249e38e31ec5e1ef6818e55c7d8749bb2765
MD5 1a97ad73e310df84f251a78619e3c114
BLAKE2b-256 d23108bd6854e60863054df9b5daf728e822f1d963616a6f47830db374c183f4

See more details on using hashes here.

Supported by

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