And for completeness, here's a wrapper script that uses the env var
PYFLAKES_BUILTINS
#!/usr/bin/env python
import os, __builtin__
names = os.environ.get('PYFLAKES_BUILTINS', '')
names = [x.strip() for x in names.split(',')]
for x in names:
if not hasattr(__builtin__, x):
setattr(__builtin__, x, True)
del names, os, __builtin__
from pyflakes.scripts.pyflakes import main
main()
--
You received this bug notification because you are a member of Divmod-
dev, which is the registrant for Pyflakes.
https://bugs.launchpad.net/bugs/844592
Title:
Recognize _("text") from gettext.install(...)
Status in Pyflakes:
Won't Fix
Bug description:
gettext module provides convenience function gettext.install() that
injects a callable _ [single underscore] into builtins, so that
internationalized code can be written like this:
print _("text")
pyflakes reports every _ as undefined symbol.
moreover since it is injected in builtins, all imported modules have
that symbol, thus the following works:
# main.py
import gettext
import somemod
gettext.install(...)
#somemod.py
print _("text")
I'm not sure what sort of heuristic could be used to recognize _() when
pyflake checks somemod.py.
Perhaps a command line argument for extra builtins?
To manage notifications about this bug go to:
https://bugs.launchpad.net/pyflakes/+bug/844592/+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