-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Add regex stubs #6713
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
Add regex stubs #6713
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.
Some direction on these points (plus any general improvements) would be really appreciated, thanks! 😄
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.
With the latest mypy release, we no longer need uppercase Tuple
(and attempting to import it will cause CI to fail after the changes to check_new_syntax
that I introduced in #6717 🙂)
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.
This should be ready for review now 😄
Thank you so much! Your PR is just in time 🚀🚀🚀 |
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Akuli <akuviljanen17@gmail.com>
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.
Thanks!
Awesome, thanks @Akuli and @AlexWaygood for the great reviews 😄 |
) -> Scanner[AnyStr]: ... | ||
|
||
@final | ||
class Match(Generic[AnyStr]): |
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.
Is this missing __getitem__
? After updating some modules I now get hundreds of "__getitem__" method not defined on type "Match[str]"
errors.
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'm not using regex
and have not investigated, but this seems likely. re.Match
(or rather typing.Match
) also has a __getitem__()
field. Cc @jpy-git
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.
Makes sense, will make a PR 👍
This PR closes #6710.
Aim is to provide typing stubs for the
regex
package.This regex implementation is backwards-compatible with the standard 're' module, but offers additional functionality.
Github: https://github.com/mrabarnett/mrab-regex
PyPI: https://pypi.org/project/regex/
I'm opening this as a draft as I have a couple questions about how to reference types for classes defined in C code (will annotate the PR with the questions). Any help/suggestions are greatly appreciated 😄