Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions stubs/regex/METADATA.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
version = "2021.11.10"
1 change: 1 addition & 0 deletions stubs/regex/regex/__init__.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .regex import *
13 changes: 13 additions & 0 deletions stubs/regex/regex/_regex.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from typing import Any

class Pattern:
def __getattr__(self, name: str) -> Any: ... # incomplete

class Match:
def __getattr__(self, name: str) -> Any: ... # incomplete

class Scanner:
def __getattr__(self, name: str) -> Any: ... # incomplete

class Splitter:
def __getattr__(self, name: str) -> Any: ... # incomplete
Comment thread
jpy-git marked this conversation as resolved.
Outdated
349 changes: 349 additions & 0 deletions stubs/regex/regex/regex.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,349 @@
from typing import Any, AnyStr, Callable, NoReturn, Tuple, overload
Comment thread
jpy-git marked this conversation as resolved.
Outdated

import regex._regex as _regex

__version__: str

A: int
ASCII: int
B: int
BESTMATCH: int
D: int
DEBUG: int
E: int
ENHANCEMATCH: int
F: int
FULLCASE: int
I: int
IGNORECASE: int
L: int
LOCALE: int
M: int
MULTILINE: int
P: int
POSIX: int
R: int
REVERSE: int
T: int
TEMPLATE: int
S: int
DOTALL: int
U: int
UNICODE: int
V0: int
VERSION0: int
V1: int
VERSION1: int
W: int
WORD: int
X: int
VERBOSE: int

DEFAULT_VERSION: int

@overload
def compile(pattern: AnyStr, flags: int = ..., ignore_unused: bool = ..., **kwargs: Any) -> _regex.Pattern: ...
@overload
def compile(pattern: _regex.Pattern, flags: int = ..., ignore_unused: bool = ..., **kwargs: Any) -> _regex.Pattern: ...
Comment thread
jpy-git marked this conversation as resolved.
Outdated
@overload
def search(
pattern: AnyStr,
string: AnyStr,
flags: int = ...,
pos: int | None = ...,
endpos: int | None = ...,
partial: bool = ...,
concurrent: bool | None = ...,
timeout: int | None = ...,
ignore_unused: bool = ...,
**kwargs: Any,
) -> _regex.Match | None: ...
@overload
def search(
pattern: _regex.Pattern,
string: AnyStr,
flags: int = ...,
pos: int | None = ...,
endpos: int | None = ...,
partial: bool = ...,
concurrent: bool | None = ...,
timeout: int | None = ...,
ignore_unused: bool = ...,
**kwargs: Any,
) -> _regex.Match | None: ...
@overload
def match(
pattern: AnyStr,
string: AnyStr,
flags: int = ...,
pos: int | None = ...,
endpos: int | None = ...,
partial: bool = ...,
concurrent: bool | None = ...,
timeout: int | None = ...,
ignore_unused: bool = ...,
**kwargs: Any,
) -> _regex.Match: ...
@overload
def match(
pattern: _regex.Pattern,
string: AnyStr,
flags: int = ...,
pos: int | None = ...,
endpos: int | None = ...,
partial: bool = ...,
concurrent: bool | None = ...,
timeout: int | None = ...,
ignore_unused: bool = ...,
**kwargs: Any,
) -> _regex.Match: ...
@overload
def fullmatch(
pattern: AnyStr,
string: AnyStr,
flags: int = ...,
pos: int | None = ...,
endpos: int | None = ...,
partial: bool = ...,
concurrent: bool | None = ...,
timeout: int | None = ...,
ignore_unused: bool = ...,
**kwargs: Any,
) -> _regex.Match: ...
@overload
def fullmatch(
pattern: _regex.Pattern,
string: AnyStr,
flags: int = ...,
pos: int | None = ...,
endpos: int | None = ...,
partial: bool = ...,
concurrent: bool | None = ...,
timeout: int | None = ...,
ignore_unused: bool = ...,
**kwargs: Any,
) -> _regex.Match: ...
@overload
def split(
pattern: AnyStr,
string: AnyStr,
maxsplit: int = ...,
flags: int = ...,
concurrent: bool | None = ...,
timeout: int | None = ...,
ignore_unused: bool = ...,
**kwargs: Any,
) -> list[AnyStr]: ...
@overload
def split(
pattern: _regex.Pattern,
string: AnyStr,
maxsplit: int = ...,
flags: int = ...,
concurrent: bool | None = ...,
timeout: int | None = ...,
ignore_unused: bool = ...,
**kwargs: Any,
) -> list[AnyStr]: ...
@overload
def splititer(
pattern: AnyStr,
string: AnyStr,
maxsplit: int = ...,
flags: int = ...,
concurrent: bool | None = ...,
timeout: int | None = ...,
ignore_unused: bool = ...,
**kwargs: Any,
) -> _regex.Splitter: ...
@overload
def splititer(
pattern: _regex.Pattern,
string: AnyStr,
maxsplit: int = ...,
flags: int = ...,
concurrent: bool | None = ...,
timeout: int | None = ...,
ignore_unused: bool = ...,
**kwargs: Any,
) -> _regex.Splitter: ...
@overload
def findall(
pattern: AnyStr,
string: AnyStr,
flags: int = ...,
pos: int | None = ...,
endpos: int | None = ...,
overlapped: bool = ...,
concurrent: bool | None = ...,
timeout: int | None = ...,
ignore_unused: bool = ...,
**kwargs: Any,
) -> list[str] | list[Tuple[str, ...]]: ...
Comment thread
jpy-git marked this conversation as resolved.
Outdated
@overload
def findall(
pattern: _regex.Pattern,
string: AnyStr,
flags: int = ...,
pos: int | None = ...,
endpos: int | None = ...,
overlapped: bool = ...,
concurrent: bool | None = ...,
timeout: int | None = ...,
ignore_unused: bool = ...,
**kwargs: Any,
) -> list[str] | list[Tuple[str, ...]]: ...
Comment thread
jpy-git marked this conversation as resolved.
Outdated
@overload
def finditer(
pattern: AnyStr,
string: AnyStr,
flags: int = ...,
pos: int | None = ...,
endpos: int | None = ...,
overlapped: bool = ...,
partial: bool = ...,
concurrent: bool | None = ...,
timeout: int | None = ...,
ignore_unused: bool = ...,
**kwargs: Any,
) -> _regex.Scanner: ...
@overload
def finditer(
pattern: _regex.Pattern,
string: AnyStr,
flags: int = ...,
pos: int | None = ...,
endpos: int | None = ...,
overlapped: bool = ...,
partial: bool = ...,
concurrent: bool | None = ...,
timeout: int | None = ...,
ignore_unused: bool = ...,
**kwargs: Any,
) -> _regex.Scanner: ...
def purge() -> None: ...
@overload
def cache_all(value: bool = ...) -> NoReturn: ...
@overload
def cache_all(value: None = ...) -> bool: ...
def escape(pattern: AnyStr, special_only: bool = ..., literal_spaces: bool = ...) -> AnyStr: ...
@overload
def template(pattern: AnyStr, flags: int = ...) -> _regex.Pattern: ...
@overload
def template(pattern: _regex.Pattern, flags: int = ...) -> _regex.Pattern: ...
@overload
def sub(
pattern: AnyStr,
repl: AnyStr | Callable[[_regex.Match], AnyStr],
string: AnyStr,
count: int = ...,
flags: int = ...,
pos: int | None = ...,
endpos: int | None = ...,
concurrent: bool | None = ...,
timeout: int | None = ...,
ignore_unused: bool = ...,
**kwargs: Any,
) -> AnyStr: ...
@overload
def sub(
pattern: _regex.Pattern,
repl: AnyStr | Callable[[_regex.Match], AnyStr],
string: AnyStr,
count: int = ...,
flags: int = ...,
pos: int | None = ...,
endpos: int | None = ...,
concurrent: bool | None = ...,
timeout: int | None = ...,
ignore_unused: bool = ...,
**kwargs: Any,
) -> AnyStr: ...
@overload
def subf(
pattern: AnyStr,
format: AnyStr | Callable[[_regex.Match], AnyStr],
string: AnyStr,
count: int = ...,
flags: int = ...,
pos: int | None = ...,
endpos: int | None = ...,
concurrent: bool | None = ...,
timeout: int | None = ...,
ignore_unused: bool = ...,
**kwargs: Any,
) -> AnyStr: ...
@overload
def subf(
pattern: _regex.Pattern,
format: AnyStr | Callable[[_regex.Match], AnyStr],
string: AnyStr,
count: int = ...,
flags: int = ...,
pos: int | None = ...,
endpos: int | None = ...,
concurrent: bool | None = ...,
timeout: int | None = ...,
ignore_unused: bool = ...,
**kwargs: Any,
) -> AnyStr: ...
@overload
def subn(
pattern: AnyStr,
repl: AnyStr | Callable[[_regex.Match], AnyStr],
string: AnyStr,
count: int = ...,
flags: int = ...,
pos: int | None = ...,
endpos: int | None = ...,
concurrent: bool | None = ...,
timeout: int | None = ...,
Comment thread
jpy-git marked this conversation as resolved.
Outdated
ignore_unused: bool = ...,
**kwargs: Any,
) -> AnyStr: ...
@overload
def subn(
pattern: _regex.Pattern,
repl: AnyStr | Callable[[_regex.Match], AnyStr],
string: AnyStr,
count: int = ...,
flags: int = ...,
pos: int | None = ...,
endpos: int | None = ...,
concurrent: bool | None = ...,
timeout: int | None = ...,
ignore_unused: bool = ...,
**kwargs: Any,
) -> AnyStr: ...
@overload
def subfn(
pattern: AnyStr,
format: AnyStr | Callable[[_regex.Match], AnyStr],
string: AnyStr,
count: int = ...,
flags: int = ...,
pos: int | None = ...,
endpos: int | None = ...,
concurrent: bool | None = ...,
timeout: int | None = ...,
ignore_unused: bool = ...,
**kwargs: Any,
) -> tuple[AnyStr, int]: ...
@overload
def subfn(
pattern: _regex.Pattern,
format: AnyStr | Callable[[_regex.Match], AnyStr],
string: AnyStr,
count: int = ...,
flags: int = ...,
pos: int | None = ...,
endpos: int | None = ...,
concurrent: bool | None = ...,
timeout: int | None = ...,
ignore_unused: bool = ...,
**kwargs: Any,
) -> tuple[AnyStr, int]: ...

Pattern: _regex.Pattern
Match: _regex.Match
Comment thread
jpy-git marked this conversation as resolved.
Outdated
Comment thread
jpy-git marked this conversation as resolved.
Outdated
Regex = compile
Comment thread
Akuli marked this conversation as resolved.