Hey Chris,

On Sun, Feb 11, 2018 at 09:19:11PM +0000, Chris Norman via code-quality wrote:
> I get that the use case is kind of non standard: I am evaling code found in
> an arbitrary, and of coruse that code is inheriting the globals and locals
> from the main script. To this end, I want to be able to do more than just
> put # noqa: F821 at the end of each line that contains one of the locals..
> that is very inconvenient and runs the high risk of suppressing a real live
> issue.

It's a bit of a hack, but what you can do is something like:

config = config  # noqa: F821

or if you use pylint as well:

config = config  # noqa: F821 pylint: disable=E0602,C0103

at the top of your script, and flake8 won't complain about it anymore

FWIW I wouldn't mind having a better way to do this either. It's a
somewhat common thing in projects using Python for configuration that
you have some config object injected into the namespace of your script,
and I'd much rather continue using flake8 in my editor for it (or
rather, for any *.py file) than not benefiting from it at all ;-)

By the way, your "subscribe" email went to the list. Command mails like
this should go to the address you get when adding "-request" to the list
address, i.e. code-quality-requ...@python.org here. I *think* you are
subscribed now or you probably couldn't post, but I'm not sure.


https://www.qutebrowser.org | m...@the-compiler.org (Mail/XMPP)
   GPG: 916E B0C8 FD55 A072 | https://the-compiler.org/pubkey.asc
         I love long mails! | https://email.is-not-s.ms/

Attachment: signature.asc
Description: PGP signature

code-quality mailing list

Reply via email to