divmod-dev team mailing list archive
-
divmod-dev team
-
Mailing list archive
-
Message #00130
[Bug 844592] Re: Recognize _("text") from gettext.install(...)
Instead of using the injected builtins feature of gettext, import the
name. Then both pyflakes and human readers of the code will know what's
going on.
from gettext import gettext as _
** Changed in: pyflakes
Status: New => Won't Fix
--
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
References