A plugin for flake8 to ban the usage of unsafe naive datetime class.
-
DTZ001 : The use of
datetime.datetime()
withouttzinfo
argument is not allowed. -
DTZ002 : The use of
datetime.datetime.today()
is not allowed. Usedatetime.datetime.now(tz=)
instead. -
DTZ003 : The use of
datetime.datetime.utcnow()
is not allowed. Usedatetime.datetime.now(tz=)
instead. -
DTZ004 : The use of
datetime.datetime.utcfromtimestamp()
is not allowed. Usedatetime.datetime.fromtimestamp(, tz=)
instead. -
DTZ005 : The use of
datetime.datetime.now()
withouttz
argument is not allowed. -
DTZ006 : The use of
datetime.datetime.fromtimestamp()
withouttz
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. Usedatetime.datetime.now(tz=).date()
instead. -
DTZ012 : The use of
datetime.date.fromtimestamp()
is not allowed. Usedatetime.datetime.fromtimestamp(, tz=).date()
instead.
Install with pip
$ pip install flake8-datetimez
- Python 3.6 or above
- flake8 3.0.0 or above
MIT