[code-quality] Possible false positives in Pyflakes

Daniel Hofmann daniel at trvx.org
Fri Jun 7 02:22:46 CEST 2013


I tried reaching someone from Pyflakes in the IRC channel on
freenode and was kindly redirected to this mailinglist, so please
tell me if this is not the appropriate place for my questions.


I discovered Pyflakes a few weeks ago and I'm using it in a project.
But it seems that I'm not able to get rid of a few errors it reports.

I'm by no means a Python professional, so this may be a mistake on my side.

The following three error messages do not make sense for me:

> dslrpicontrol/models.py:26: invalid syntax
>        flash(u'Auto-detection request failed', 'danger')
>                                              ^
> dslrpicontrol/errorhandlers.py:15: invalid syntax
>     return render_error(404, u'Page not found')
>                                              ^
> dslrpicontrol/__init__.py:28: 'dslrpicontrol' imported but unused

If you want to see the specific position, I hilighted the exact lines here:

> https://github.com/daniel-j-h/dslr-pi-control/blob/master/dslrpicontrol/models.py#L26
> https://github.com/daniel-j-h/dslr-pi-control/blob/master/dslrpicontrol/errorhandlers.py#L15
> https://github.com/daniel-j-h/dslr-pi-control/blob/master/dslrpicontrol/__init__.py#L28

The first two 'invalid syntax' error reports do not make sense to me.
Why is the syntax invalid? The Python interpreter does The Right Thing.

More about the flash() function here:
> http://flask.pocoo.org/docs/patterns/flashing/#flashing-with-categories
> http://flask.pocoo.org/docs/api/#message-flashing

The last 'imported but unused' error report probably comes from the circular imports?
This idiom was actually recommended by the Flask docs. Is this also a false positive?

I'm glad for any hints.

Cheers,
Daniel


More information about the code-quality mailing list