Thanks, Ian. I'm not sure if we'll be able to update the flake in our build/test environment, but I'll check it out locally and see what happens.
On Thu, Apr 2, 2015 at 2:31 PM, Ian Cordasco <graffatcolmin...@gmail.com> wrote: > > > On Thu, Apr 2, 2015 at 4:04 PM, Dan Wandschneider < > daniel.wandschnei...@schrodinger.com> wrote: > >> All- >> It seems like when I have a function that does "del" on a global >> variable, flake complains that a local variable is referenced before >> assignment. As far as I know, the following is valid code: >> >> server = None >> >> def stopServer(): >> global server >> if server: >> del server >> server = None >> >> test.py:6:8: F823 local variable 'server' (defined in enclosing scope on >> line 1) referenced before assignment >> >> I'm using flake --version: 2.1.0 (pep8: 1.4.6, mccabe: 0.2.1, pyflakes: >> 0.7.3) >> >> I understand that the "del" statement is redundant, but I don't think >> that it is wrong, per se. Is this code actually incorrect? If not, is there >> a way to suppress this error message? I'm interested in figuring this out >> as part of an effort to convince a coworker to start using flake on his/her >> code. >> >> Thanks - >> Dan W. >> >> _______________________________________________ >> code-quality mailing list >> code-quality@python.org >> https://mail.python.org/mailman/listinfo/code-quality >> >> > The versions you list there are kind of old. I believe pyflakes 0.8.1 is > out. Flake8 wraps pep8, mccabe, and pyflakes. The error code you're seeing > is actually generated by pyflakes. I don't think this is an actual error in > your code sample though. You should report this to pyflakes and see if > there's anything that can be done to mitigate this. In the meantime, you > can do the following: > > flake8 --ignore=F823 test.py > > And you can store that in a config file like tox.ini or setup.cfg. The > docs should explain how to do that. >
_______________________________________________ code-quality mailing list code-quality@python.org https://mail.python.org/mailman/listinfo/code-quality