Questions tagged [pyflakes]

Pyflakes analyzes Python source code non-intrusively to check for errors.

Pyflakes analyzes Python source code non-intrusively to check for errors.

Similar to the C language source code analyzer lint, Pyflakes performs similar function on Python source code. It can be used to check for simple errors like misplaced quotes, code indentation inconsistencies, syntax errors, referenced but undeclared variables, unused imported modules, etc. A very useful tool for any Python developer's toolkit!

See also:

83 questions
3
votes
2 answers

Ignore doctests/docstrings with pyflakes/pylint

Right now, if I have some function like this and I'd like to be able to get the error about index not being defined, while ignoring the error that some_index is not defined. def myfunction(ind, other): """ Parameters ---------- ind:…
Jeff Tratner
  • 16,270
  • 4
  • 47
  • 67
3
votes
1 answer

Is there a python syntax checker that can ignore ' assigned to but never used' when locals() is present?

suppose I have the code def foo(): bar = 1 wibble = 3 return locals() my current syntax checker (flake8 with syntastic.vim) will throw a 'assigned to but never used' error on both variables. However locals() implies something is they…
michael
  • 11,667
  • 2
  • 26
  • 25
3
votes
2 answers

Running flymake for python when files don't have .py extension

I'm not a lisp guy at all, but my primary scripting environment lives on emacs and I need some help to get my flymake/pyflakes running when there is no .py extension on files. Because some of the scripts here at my work doesn't have .py extension on…
Muhammet Can
  • 1,304
  • 2
  • 16
  • 30
3
votes
5 answers

Emacs 23 hangs on python mode when typing string block """

My Emacs hangs (Ubuntu 9 + Emacs 23 + Pyflakes) when I type """ quotes for string blocks. Anybody experienced the same problem? I think, it may not be an Emacs problem but some Python mode or Pyflakes which I use it for error checking. Anybody got…
user90150
3
votes
1 answer

Pyflakes + pep8 check on vim in normal mode

I use vim as my IDE with python and it's been great. I use pyflakes + pep8 with the appropriate plugin. I need these additional features: pyflakes check "on the fly" without having to switch to normal mode. pep8 check "on the fly". Currently, I…
npcomplete
  • 174
  • 1
  • 7
2
votes
2 answers

Disable linting in Spyder (orange triangles from Pyflakes)

I have an import that is only used in a doctest. The linter (Pyflakes) that is used by Spyder to generate warnings right next to the code doesn't like this. I tried a bunch of ways of turning off the "imported but unused" warning, but the orange…
Ilya
  • 466
  • 2
  • 14
2
votes
1 answer

Python: pyflakes not interpreting noqa comment

I have something weird going on with pyflakes and noqa comments. I have a class similar to the one below (MyExample): It's the only file in a directory called pyflakes_f811_test. It only inherits from abc.ABC. I use typing.overload to overload a…
Intrastellar Explorer
  • 3,005
  • 9
  • 52
  • 119
2
votes
4 answers

Elegant way for keeping the previous item accessible in a loop through items of a list

Summary: In a Python Project I need to apply a function to each two elements of a list of lists that have the same inner index and a neighbouring outer index. The outputs get stored in a new matrix. The code I've written works, but is not elegant…
lgott
  • 53
  • 1
  • 8
2
votes
1 answer

how to only use pyflakes checks with pep8 (never style checks)?

I'm migrating from pyflakes to flake8 to get the # noqa line ignore feature. To ease the migration, I'd like to start with only checking whatever pyflakes was previously checking, and I like pyflakes simple promise to "will never complain about…
JDiMatteo
  • 12,022
  • 5
  • 54
  • 65
2
votes
2 answers

Vim: Pyflakes Conflicting With Vimgrep/Grep

I just recently installed Pyflakes Vim plugin. It works very fine and is very helpful. Unfortunately it uses the error list in case there is an error. So if I make a search-in-files using Vimgrep or Grep, then after using :cnext to show the next…
Rafid
  • 18,991
  • 23
  • 72
  • 108
2
votes
1 answer

Is this a flake8 false positive, or am I really doing something wrong?

I have a function that can be simplified to this code sample: def test_fun(): for i in range(17): item = i print(item) for i in range(42): items = [[i], [i], [i]] flatten_items = [item[0] for item in items] …
julienc
  • 19,087
  • 17
  • 82
  • 82
2
votes
1 answer

Flake8 not using pyflakes in global python instance

My pyflakes portion of flake8 is not running for my global python instance (/usr/bin/python, not virtualenv). flake8 --version 2.2.3 (pep8: 1.5.7, mccabe: 0.2.1) CPython 2.7.5 on Darwin It doesn't seem like pyflakes is getting attached to flake8.…
KFunk
  • 2,956
  • 22
  • 33
2
votes
1 answer

Checking unwanted type change in Python

I come from static-type programming and I'm interested in understanding the rationale behind dynamic-type programming to check if dynamic-type languages can better fit my needs. I've read about the theory behind duck programming. I've also read that…
Claudio
  • 10,614
  • 4
  • 31
  • 71
2
votes
1 answer

What does pyflakes w804 signify?

I'm working on a decorator that will retry running a function up to N times as follows: def retry(exceptions, truncate=5, delay=0.25): """Retry the decorated function using an exponential backoff strategy. …
Ceasar
  • 22,185
  • 15
  • 64
  • 83
1
vote
0 answers

pyflakes say "'_' may be undefined" when using gettext class-based API

I do use GNU gettext class-based API. In practice this means that the function _() is not explicit declare by myself in each module like this: import gettext t = gettext.translation('spam', '/usr/share/locale') _ = t.gettext But it is done like…
buhtz
  • 10,774
  • 18
  • 76
  • 149