2 # Ron Murawski <ron@horizonchess.com>
\r
3 # 'bytes' support added by Jukka Lehtosalo
\r
5 # based on: http://docs.python.org/3.2/library/re.html
\r
6 # and http://hg.python.org/cpython/file/618ea5612e83/Lib/re.py
\r
10 List, Iterator, overload, Callable, Tuple, Sequence, Dict,
\r
11 Generic, AnyStr, Match, Pattern, Any, Optional, Union
\r
14 # ----- re variables and constants -----
\r
15 if sys.version_info >= (3, 6):
\r
17 class RegexFlag(enum.IntFlag):
\r
37 ASCII = RegexFlag.ASCII
\r
38 DEBUG = RegexFlag.DEBUG
\r
40 IGNORECASE = RegexFlag.IGNORECASE
\r
42 LOCALE = RegexFlag.LOCALE
\r
44 MULTILINE = RegexFlag.MULTILINE
\r
46 DOTALL = RegexFlag.DOTALL
\r
48 VERBOSE = RegexFlag.VERBOSE
\r
50 UNICODE = RegexFlag.UNICODE
\r
52 TEMPLATE = RegexFlag.TEMPLATE
\r
53 _FlagsType = Union[int, RegexFlag]
\r
74 class error(Exception): ...
\r
77 def compile(pattern: AnyStr, flags: _FlagsType = ...) -> Pattern[AnyStr]: ...
\r
79 def compile(pattern: Pattern[AnyStr], flags: _FlagsType = ...) -> Pattern[AnyStr]: ...
\r
82 def search(pattern: AnyStr, string: AnyStr, flags: _FlagsType = ...) -> Optional[Match[AnyStr]]: ...
\r
84 def search(pattern: Pattern[AnyStr], string: AnyStr, flags: _FlagsType = ...) -> Optional[Match[AnyStr]]: ...
\r
87 def match(pattern: AnyStr, string: AnyStr, flags: _FlagsType = ...) -> Optional[Match[AnyStr]]: ...
\r
89 def match(pattern: Pattern[AnyStr], string: AnyStr, flags: _FlagsType = ...) -> Optional[Match[AnyStr]]: ...
\r
93 def fullmatch(pattern: AnyStr, string: AnyStr, flags: _FlagsType = ...) -> Optional[Match[AnyStr]]: ...
\r
95 def fullmatch(pattern: Pattern[AnyStr], string: AnyStr, flags: _FlagsType = ...) -> Optional[Match[AnyStr]]: ...
\r
98 def split(pattern: AnyStr, string: AnyStr,
\r
99 maxsplit: int = ..., flags: _FlagsType = ...) -> List[AnyStr]: ...
\r
101 def split(pattern: Pattern[AnyStr], string: AnyStr,
\r
102 maxsplit: int = ..., flags: _FlagsType = ...) -> List[AnyStr]: ...
\r
105 def findall(pattern: AnyStr, string: AnyStr, flags: _FlagsType = ...) -> List[Any]: ...
\r
107 def findall(pattern: Pattern[AnyStr], string: AnyStr, flags: _FlagsType = ...) -> List[Any]: ...
\r
109 # Return an iterator yielding match objects over all non-overlapping matches
\r
110 # for the RE pattern in string. The string is scanned left-to-right, and
\r
111 # matches are returned in the order found. Empty matches are included in the
\r
112 # result unless they touch the beginning of another match.
\r
114 def finditer(pattern: AnyStr, string: AnyStr,
\r
115 flags: _FlagsType = ...) -> Iterator[Match[AnyStr]]: ...
\r
117 def finditer(pattern: Pattern[AnyStr], string: AnyStr,
\r
118 flags: _FlagsType = ...) -> Iterator[Match[AnyStr]]: ...
\r
121 def sub(pattern: AnyStr, repl: AnyStr, string: AnyStr, count: int = ...,
\r
122 flags: _FlagsType = ...) -> AnyStr: ...
\r
124 def sub(pattern: AnyStr, repl: Callable[[Match[AnyStr]], AnyStr],
\r
125 string: AnyStr, count: int = ..., flags: _FlagsType = ...) -> AnyStr: ...
\r
127 def sub(pattern: Pattern[AnyStr], repl: AnyStr, string: AnyStr, count: int = ...,
\r
128 flags: _FlagsType = ...) -> AnyStr: ...
\r
130 def sub(pattern: Pattern[AnyStr], repl: Callable[[Match[AnyStr]], AnyStr],
\r
131 string: AnyStr, count: int = ..., flags: _FlagsType = ...) -> AnyStr: ...
\r
134 def subn(pattern: AnyStr, repl: AnyStr, string: AnyStr, count: int = ...,
\r
135 flags: _FlagsType = ...) -> Tuple[AnyStr, int]: ...
\r
137 def subn(pattern: AnyStr, repl: Callable[[Match[AnyStr]], AnyStr],
\r
138 string: AnyStr, count: int = ...,
\r
139 flags: _FlagsType = ...) -> Tuple[AnyStr, int]: ...
\r
141 def subn(pattern: Pattern[AnyStr], repl: AnyStr, string: AnyStr, count: int = ...,
\r
142 flags: _FlagsType = ...) -> Tuple[AnyStr, int]: ...
\r
144 def subn(pattern: Pattern[AnyStr], repl: Callable[[Match[AnyStr]], AnyStr],
\r
145 string: AnyStr, count: int = ...,
\r
146 flags: _FlagsType = ...) -> Tuple[AnyStr, int]: ...
\r
148 def escape(string: AnyStr) -> AnyStr: ...
\r
150 def purge() -> None: ...
\r
151 def template(pattern: Union[AnyStr, Pattern[AnyStr]], flags: _FlagsType = ...) -> Pattern[AnyStr]: ...
\r