sre_compile: use TypeIs (#15263)

This commit is contained in:
Jelle Zijlstra
2026-01-11 15:47:09 -08:00
committed by GitHub
parent 3735956f83
commit 5c5f3eb390
+3 -6
View File
@@ -2,14 +2,11 @@ from re import Pattern
from sre_constants import *
from sre_constants import _NamedIntConstant
from sre_parse import SubPattern
from typing import Any, Final, Literal, overload
from typing_extensions import TypeGuard
from typing import Any, Final
from typing_extensions import TypeIs
MAXCODE: Final[int]
def dis(code: list[_NamedIntConstant]) -> None: ...
@overload
def isstring(obj: str | bytes) -> Literal[True]: ...
@overload
def isstring(obj: object) -> TypeGuard[str | bytes]: ...
def isstring(obj: object) -> TypeIs[str | bytes]: ...
def compile(p: str | bytes | SubPattern, flags: int = 0) -> Pattern[Any]: ...