From c5439668fef6e53c049d55ea8d0625b48f1f84e3 Mon Sep 17 00:00:00 2001 From: Ashwini Chaudhary Date: Fri, 15 Dec 2017 10:22:54 +0530 Subject: [PATCH] Added stub for sre_compile(2and3) (#1493) --- stdlib/2and3/sre_compile.pyi | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 stdlib/2and3/sre_compile.pyi diff --git a/stdlib/2and3/sre_compile.pyi b/stdlib/2and3/sre_compile.pyi new file mode 100644 index 000000000..c74bd85f3 --- /dev/null +++ b/stdlib/2and3/sre_compile.pyi @@ -0,0 +1,18 @@ +# Source: https://hg.python.org/cpython/file/2.7/Lib/sre_compile.py +# and https://github.com/python/cpython/blob/master/Lib/sre_compile.py + +import sys +from sre_parse import SubPattern +from typing import Any, List, Pattern, Tuple, Type, TypeVar, Union + +MAXCODE = ... # type: int +if sys.version_info < (3, 0): + STRING_TYPES: Tuple[Type[str], Type[unicode]] + _IsStringType = int +else: + from sre_constants import _NamedIntConstant + def dis(code: List[_NamedIntConstant]) -> None: ... + _IsStringType = bool + +def isstring(obj: Any) -> _IsStringType: ... +def compile(p: Union[str, bytes, SubPattern], flags: int = ...) -> Pattern: ...