Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

python: flake8 cannot find non exising method

Tags:

python

flake8

If I do something like:

new_list = []
new_list.foo()

flake8 does not return an error for foo() method since it is not a 'list' method.

Is this normal or do I need to configure something?

like image 497
George B. Avatar asked Sep 18 '26 19:09

George B.


1 Answers

flake8 does not handle the problem, but PyLint does - issues the no-member warning:

$ pylint test.py
No config file found, using default configuration
************* Module test
C:  1, 0: Missing module docstring (missing-docstring)
C:  1, 0: Invalid constant name "new_list" (invalid-name)
E:  2, 0: Instance of 'list' has no 'foo' member (no-member)

And, the built-in to PyCharm code analyzer would also warn about the unresolved attribute:

enter image description here

like image 98
alecxe Avatar answered Sep 21 '26 09:09

alecxe