-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Added Scanner to re.pyi #3071
Added Scanner to re.pyi #3071
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -153,3 +153,11 @@ def escape(string: AnyStr) -> AnyStr: ... | |||||||||
|
||||||||||
def purge() -> None: ... | ||||||||||
def template(pattern: Union[AnyStr, Pattern[AnyStr]], flags: _FlagsType = ...) -> Pattern[AnyStr]: ... | ||||||||||
|
||||||||||
class Scanner: | ||||||||||
def __init__( | ||||||||||
self, | ||||||||||
lexicon: Sequence[Tuple[AnyStr, Callable[[Scanner, AnyStr], Any]]], | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems the action can be anything, not just a callable:
Suggested change
Alternatively, another
Suggested change
|
||||||||||
flags: _FlagsType = ..., | ||||||||||
) -> None: ... | ||||||||||
def scan(self, string: AnyStr) -> Tuple[List[Any], AnyStr]: ... | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the case of introducing another type var, |
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.
Please add an undocumented flag. Also, this needs to be generic over
AnyStr
for the methods to have correct types: