I do use GNU gettext class-based API. In practice this means that the function _()
is not explicit declare by myself in each module like this:
import gettext
t = gettext.translation('spam', '/usr/share/locale')
_ = t.gettext
But it is done like this
import gettext
gettext.install('myapplication')
In the back this install()
declares the _()
in the back and place it into the builtins namespace so I can use it in every module.
But this is a problem from the point of view of linters like pyflake:
pyflakes: '_' may be undefined, or defined from star imports
Of course I do use _()
everywhere in my code but it is not declare elsewhere but implicit via gettext.install()
.
Any idea how to solve this? There are a lot of locations where I do use _()
. So I don't want to put an # noqa
behind it.