[sre_compile] Use TypeGuard for isstring (#15250)

This commit is contained in:
Semyon Moroz
2026-01-10 23:20:27 +00:00
committed by GitHub
parent e213e04a84
commit 9840c58451
+6 -2
View File
@@ -2,10 +2,14 @@ from re import Pattern
from sre_constants import *
from sre_constants import _NamedIntConstant
from sre_parse import SubPattern
from typing import Any, Final
from typing import Any, Final, Literal, overload
from typing_extensions import TypeGuard
MAXCODE: Final[int]
def dis(code: list[_NamedIntConstant]) -> None: ...
def isstring(obj: Any) -> bool: ...
@overload
def isstring(obj: str | bytes) -> Literal[True]: ...
@overload
def isstring(obj: object) -> TypeGuard[str | bytes]: ...
def compile(p: str | bytes | SubPattern, flags: int = 0) -> Pattern[Any]: ...