New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bpo-36310: Allow pygettext.py
to detect calls to gettext
in f-strings.
#19875
bpo-36310: Allow pygettext.py
to detect calls to gettext
in f-strings.
#19875
Conversation
pygettext.py
to detect calls to gettext
in f-strings.
Closing and re-opening to re-run the CI tests. |
Co-authored-by: Batuhan Taskaya <batuhanosmantaskaya@gmail.com>
624d4d1
to
309245d
Compare
I added a few test cases and fixed the mentioned issue with node types. |
That seems like something that at least one test case should cover. |
@jack1142, just wanted to thank you for your work on this! I definitely think it would be a boon to have this in Python. |
Okay, I added a few tests based on the paths where parsing is supposed to ignore the nodes including the one I mentioned above. While I'm commenting already, I just wanted to remind that I have 2 comments in the code in places where I think we should be printing some warning, so that the output contains information about incorrect usage of
I'm glad you like it |
Misc/NEWS.d/next/Tools-Demos/2020-05-03-01-30-46.bpo-36310.xDxxwY.rst
Outdated
Show resolved
Hide resolved
Co-authored-by: Batuhan Taskaya <batuhanosmantaskaya@gmail.com>
Thanks, @jack1142 for your patch, and fast responses to reviews! Hope to see more from you |
pythonGH-19875) Adds support to Tools/i18n/pygettext.py for gettext calls in f-strings. This process is done by parsing the f-strings, processing each value, and flagging the ones which contain a gettext call. Co-authored-by: Batuhan Taskaya <batuhanosmantaskaya@gmail.com>
Adds support for
gettext
calls in f-strings. This was implemented using AST to parse the f-string since it seems like the simplest way to do this.There are two places in which we should probably print a warning (I put a comment in each) but I'm not sure what the warning should be as unlike for regular string cases, there's no specific unexpected token I can print warning about.
https://bugs.python.org/issue36310