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() without %z must be followed by .replace(tzinfo=) or .astimezone().
  • 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.

Files for flake8-datetimez, version 20.10.0
Filename, size File type Python version Upload date Hashes
Filename, size flake8_datetimez-20.10.0-py3-none-any.whl (5.7 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size flake8-datetimez-20.10.0.tar.gz (4.2 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page