flake8 plugin which checks for code that can be simpified
Project description
flake8-simplify
A flake8 plugin that helps you simplify your code.
Installation
Install with pip
:
pip install flake8-simplify
Python 3.6 to 3.8 are supported.
Usage
Just call flake8 .
in your package or flake your.py
:
$ flake8 .
./foo/__init__.py:690:12: SIM101 Multiple isinstance-calls which can be merged into a single call for variable 'other'
Rules
SIM101
: Multiple isinstance-calls which can be merged into a single call by using a tuple as a second argument.SIM201
: Use 'a != b' instead of 'not a == b'SIM202
: Use 'a == b' instead of 'not a != b'SIM203
: Use 'a not in b' instead of 'not a in b'
Examples
SIM101
# Bad
isinstance(a, int) or isinstance(a, float)
# Good
isinstance(a, (int, float))
SIM201
# Bad
not a == b
# Good
a != b
SIM202
# Bad
not a != b
# Good
a == b
SIM203
# Bad
not a in b
# Good
a not in b
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
flake8_simplify-0.3.0.tar.gz
(4.7 kB
view hashes)
Built Distribution
Close
Hashes for flake8_simplify-0.3.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fc44282a18bedaec6ed7d33cbabe64afd8ba53ed273ac11dc2f271d7742d9662 |
|
MD5 | a417872bcb69dec65371cdb5abfa4780 |
|
BLAKE2b-256 | 5201bf28ed96df0d2ad0207e8a07c762aedfa4696c4eeca6bd007d6aee186170 |