Skip to content
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

pybabel extract: Support multiple keywords with the same name/arity #1157

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

EmilyBStudent
Copy link

Extend pybabel extract's keywords dict format to support multiple keywords with same function name and number of arguments.

Fixes #1067 : pybabel extract command from CLI only respects the first argument passed into keywords

I've been working on a fix for this and I have it working. I've had to extend the keywords dict format to allow for multiple specs per number of arguments, but I've made sure the old format is still accepted (and generated by default, if the extended format isn't required), and all existing unit tests still pass without changes. However I feel my code isn't the most elegant so I would welcome feedback.

The main issue as I see it is that I've used tuples to contain the multiple specs. This creates a situation where we can have several nested tuples and it's difficult to distinguish a tuple for an individual spec from a tuple enclosing (potentially) multiple specs. Would it be more suitable to use a list instead when we need to store multiple specs in the dictionary, or would this introduce too much overhead/potential errors?

Extend keywords dict to support multiple keywords with same name/arity

Fixes python-babel#1067
Extend keywords dict to support multiple keywords with same name/arity

Fixes python-babel#1067
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pybabel extract command from CLI only respects the first argument passed into keywords
1 participant