PyCQA / pycodestyle

Simple Python style checker in one Python file
https://pycodestyle.pycqa.org
Other
5.03k stars 754 forks source link

E721 false positive with method access #1192

Closed shadchin closed 8 months ago

shadchin commented 1 year ago

Environment

% python -V
Python 3.11.3
% pycodestyle --version
2.11.0

% pip list
Package     Version
----------- -------
django-upgrade 1.14.0
flake8         6.1.0
mccabe         0.7.0
pip            23.2.1
pycodestyle    2.11.0
pyflakes       3.1.0
pyupgrade      3.9.0
setuptools     65.5.0
tokenize-rt    5.1.0

E721 false positive

% cat test.py
import foo

assert foo.type("foo") == "bar"
% pycodestyle test.py
test.py:4:12: E721 do not compare types, for exact checks use `is` / `is not`, for instance checks use `isinstance()`
da-raf commented 8 months ago

suggested fix: https://github.com/PyCQA/pycodestyle/pull/1228