-
-
Notifications
You must be signed in to change notification settings - Fork 526
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
Conversation
There was a problem hiding this 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.
src/tox/package/local.py
Outdated
@@ -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)") |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 🙂
There was a problem hiding this 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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. :)