move re.error into re.pyi (#11188)

This commit is contained in:
Stephen Morton
2024-10-02 02:26:44 -07:00
committed by GitHub
parent 6ba6589144
commit 719ddd1774
2 changed files with 11 additions and 9 deletions

View File

@@ -4,7 +4,6 @@ import sre_constants
import sys
from _typeshed import ReadableBuffer
from collections.abc import Callable, Iterator, Mapping
from sre_constants import error as error
from typing import Any, AnyStr, Generic, Literal, TypeVar, final, overload
from typing_extensions import TypeAlias
@@ -54,6 +53,16 @@ if sys.version_info >= (3, 13):
_T = TypeVar("_T")
# The implementation defines this in re._constants (version_info >= 3, 11) or
# sre_constants. Typeshed has it here because its __module__ attribute is set to "re".
class error(Exception):
msg: str
pattern: str | bytes | None
pos: int | None
lineno: int
colno: int
def __init__(self, msg: str, pattern: str | bytes | None = None, pos: int | None = None) -> None: ...
@final
class Match(Generic[AnyStr]):
@property

View File

@@ -1,4 +1,5 @@
import sys
from re import error as error
from typing import Any
from typing_extensions import Self
@@ -6,14 +7,6 @@ MAXGROUPS: int
MAGIC: int
class error(Exception):
msg: str
pattern: str | bytes | None
pos: int | None
lineno: int
colno: int
def __init__(self, msg: str, pattern: str | bytes | None = None, pos: int | None = None) -> None: ...
class _NamedIntConstant(int):
name: Any
def __new__(cls, value: int, name: str) -> Self: ...