re: 3.11 fixes (#7859)

This commit is contained in:
Jelle Zijlstra
2022-05-17 21:42:23 -07:00
committed by GitHub
parent bd394d2486
commit 7998906226
4 changed files with 18 additions and 20 deletions

View File

@@ -25,7 +25,6 @@ if sys.version_info >= (3, 11):
"finditer",
"compile",
"purge",
"template",
"escape",
"error",
"Pattern",
@@ -126,8 +125,9 @@ class RegexFlag(enum.IntFlag):
VERBOSE = X
U = sre_compile.SRE_FLAG_UNICODE
UNICODE = U
T = sre_compile.SRE_FLAG_TEMPLATE
TEMPLATE = T
if sys.version_info < (3, 11):
T = sre_compile.SRE_FLAG_TEMPLATE
TEMPLATE = T
if sys.version_info >= (3, 11):
NOFLAG: int
@@ -146,8 +146,9 @@ X = RegexFlag.X
VERBOSE = RegexFlag.VERBOSE
U = RegexFlag.U
UNICODE = RegexFlag.UNICODE
T = RegexFlag.T
TEMPLATE = RegexFlag.TEMPLATE
if sys.version_info < (3, 11):
T = RegexFlag.T
TEMPLATE = RegexFlag.TEMPLATE
if sys.version_info >= (3, 11):
NOFLAG = RegexFlag.NOFLAG
_FlagsType: TypeAlias = int | RegexFlag
@@ -219,4 +220,6 @@ def subn(
) -> tuple[bytes, int]: ...
def escape(pattern: AnyStr) -> AnyStr: ...
def purge() -> None: ...
def template(pattern: AnyStr | Pattern[AnyStr], flags: _FlagsType = ...) -> Pattern[AnyStr]: ...
if sys.version_info < (3, 11):
def template(pattern: AnyStr | Pattern[AnyStr], flags: _FlagsType = ...) -> Pattern[AnyStr]: ...