mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-01-15 15:46:46 +08:00
move re.error into re.pyi (#11188)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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: ...
|
||||
|
||||
Reference in New Issue
Block a user