We have some questionable-but-necessary code which uses globals().update(). The of course causes pyflakes to freak out about undefined variables. I'd like to be able to ignore those warnings, instead of ignoring pyflakes altogether.
-- You received this bug notification because you are a member of Divmod- dev, which is the registrant for Pyflakes. https://bugs.launchpad.net/bugs/907742 Title: Add support for ignoring some warnings Status in Pocket-Lint: Triaged Status in Pyflakes: New Bug description: It would be nice if pyflakes would provide an option for ignoring some warnings. For example I have this code: try: from setproctitle import setproctitle except ImportError: setproctitle = lambda t: None # pyflakes:ignore And pyflakes will complain that setproctitle is redefined. Maybe this is a bad code and this kind of things should be never ignored, but I just want to know if such a feature is wanted in pyflakes. Here is a workaround for implementing pyflakes:ignore class PocketLintPyFlakesChecker(PyFlakesChecker): '''PocketLint checker for pyflakes. This is here to work around some of the pyflakes problems. Beside the AST tree, it is also initialized with the plain text content of the file. ''' def __init__(self, tree, filename='(none)', text=None): self.text = text if self.text: self.text = self.text.split('\n') super(PocketLintPyFlakesChecker, self).__init__( tree=tree, filename=filename) def report(self, messageClass, *args, **kwargs): text_lineno = args[0] - 1 if self.text[text_lineno].find('pyflakes:ignore') >= 0: return self.messages.append(messageClass(self.filename, *args, **kwargs)) To manage notifications about this bug go to: https://bugs.launchpad.net/pocket-lint/+bug/907742/+subscriptions -- Mailing list: https://launchpad.net/~divmod-dev Post to : [email protected] Unsubscribe : https://launchpad.net/~divmod-dev More help : https://help.launchpad.net/ListHelp

