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

Find the reverse-replacements by strictly using single pass and maximal munch #761

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ztane
Copy link

@ztane ztane commented Jul 30, 2024

I.e. if {{ cookiecutter.foo }} is substituted with car and {{ cookiecutter.bar }} with carpet the reverse mapping from carpet should be uniquely {{ cookiecutter.bar }} and never {{ cookiecutter.foo }}pet.

Likewise, the replacements should not target the jinja2 substitutions themselves; the previous code could have resulted in {{ {{ cookiecutter.project_name }}.foobar }} if the project name was cookiecutter :D

@ztane
Copy link
Author

ztane commented Aug 4, 2024

Hmm, seems to have a formatting issue but also mypy complains about re.Match not being typed as re.Match[bytes]. But the generic was introduced only in 3.9 :/

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.

1 participant