Added stub for sre_compile(2and3) (#1493)

This commit is contained in:
Ashwini Chaudhary
2017-12-15 10:22:54 +05:30
committed by Jelle Zijlstra
parent cb1d150092
commit c5439668fe

View File

@@ -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: ...