Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pjknkda/flake8-datetimez
A plugin for flake8 to ban the usage of unsafe naive datetime class.
https://github.com/pjknkda/flake8-datetimez
Last synced: 3 months ago
JSON representation
A plugin for flake8 to ban the usage of unsafe naive datetime class.
- Host: GitHub
- URL: https://github.com/pjknkda/flake8-datetimez
- Owner: pjknkda
- License: mit
- Created: 2019-04-25T18:41:48.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-12-12T13:46:48.000Z (almost 2 years ago)
- Last Synced: 2024-07-10T20:45:47.663Z (4 months ago)
- Language: Python
- Homepage:
- Size: 17.6 KB
- Stars: 33
- Watchers: 2
- Forks: 3
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-flake8-extensions - flake8-datetimez - A plugin for flake8 to ban the usage of unsafe naive datetime class. (Clean code)
README
# 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