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

Remove redundant character escape in some regexes #2051

Merged
merged 2 commits into from
May 3, 2021

Conversation

noviluni
Copy link

I observed that some regexes were hard to read because they had unnecessary escaping, so I cleaned them up.

After that, I run the tests and all passed. Let me know if there's anything you want to discuss. :)

Copy link
Member

@eumiro eumiro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your merge request, @noviluni. Just one possible improvement while you're at it.

@@ -49,7 +49,7 @@ def get_latest_version_of_package(package_spec):
return candidates[0]


_REGEX_FILE_NAME_WITH_VERSION = re.compile(r"[\w_\-\+\.]+-(.*)\.(zip|tar\.gz)")
_REGEX_FILE_NAME_WITH_VERSION = re.compile(r"[\w_\-+.]+-(.*)\.(zip|tar\.gz)")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about moving that \- to beginning/end of the […] block to unescape it too?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hey! good idea @eumiro

I updated the branch with this change 🙂

@noviluni noviluni force-pushed the improve_regexes branch from f99c02d to 28eae92 Compare May 3, 2021 13:43
@noviluni noviluni force-pushed the improve_regexes branch from 28eae92 to b5a31a9 Compare May 3, 2021 13:45
@noviluni noviluni requested a review from eumiro May 3, 2021 13:49
Copy link
Member

@eumiro eumiro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you @noviluni

Copy link
Member

@gaborbernat gaborbernat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gaborbernat gaborbernat merged commit 726a275 into tox-dev:master May 3, 2021
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.

3 participants