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

Use re.fullmatch when available #286

Merged
merged 1 commit into from
Dec 5, 2023

Conversation

Tasssadar
Copy link
Contributor

@Tasssadar Tasssadar commented Nov 28, 2023

Python's re has fullmatch method built-in since 3.4, and it is much faster than re-compiling the patterns all the time. The speed-up is visible even when running tests, they are 1s faster with this.

Also removing the flags parameter, which was unused and broken.

Copy link
Owner

@daviddrysdale daviddrysdale left a comment

Choose a reason for hiding this comment

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

Thanks!

return m


if __name__ == "__main__": # pragma no cover
Copy link
Owner

Choose a reason for hiding this comment

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

nit: is there a reason to change quote style and add blank lines?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

nope, autoformatting - fixed now, sorry.

@daviddrysdale daviddrysdale merged commit dc46a8e into daviddrysdale:dev Dec 5, 2023
12 checks passed
@daviddrysdale
Copy link
Owner

Thanks!

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.

2 participants