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. |
isidentical
left a comment
There was a problem hiding this comment.
It would be also nice if you add a test case for this inside of test.test_i18n.Test_pygettext
Co-authored-by: Batuhan Taskaya <batuhanosmantaskaya@gmail.com>
|
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 😄 |
isidentical
left a comment
There was a problem hiding this comment.
I had 3 very little comments, but overall LGTM. Thanks for the work @jack1142!
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
gettextcalls 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