Format: application/octet-stream
⬇ Download File (3.6 KB)
   1  from typing import (
   2      Any,
   3      AnyStr,
   4      Callable,
   5      Dict,
   6      Generic,
   7      Iterator,
   8      List,
   9      Match,
  10      Optional,
  11      Pattern,
  12      Sequence,
  13      Tuple,
  14      Union,
  15      overload,
  16  )
  17  
  18  # ----- re variables and constants -----
  19  DEBUG: int
  20  I: int
  21  IGNORECASE: int
  22  L: int
  23  LOCALE: int
  24  M: int
  25  MULTILINE: int
  26  S: int
  27  DOTALL: int
  28  X: int
  29  VERBOSE: int
  30  U: int
  31  UNICODE: int
  32  T: int
  33  TEMPLATE: int
  34  
  35  class error(Exception): ...
  36  
  37  @overload
  38  def compile(pattern: AnyStr, flags: int = ...) -> Pattern[AnyStr]: ...
  39  @overload
  40  def compile(pattern: Pattern[AnyStr], flags: int = ...) -> Pattern[AnyStr]: ...
  41  @overload
  42  def search(pattern: Union[str, unicode], string: AnyStr, flags: int = ...) -> Optional[Match[AnyStr]]: ...
  43  @overload
  44  def search(pattern: Union[Pattern[str], Pattern[unicode]], string: AnyStr, flags: int = ...) -> Optional[Match[AnyStr]]: ...
  45  @overload
  46  def match(pattern: Union[str, unicode], string: AnyStr, flags: int = ...) -> Optional[Match[AnyStr]]: ...
  47  @overload
  48  def match(pattern: Union[Pattern[str], Pattern[unicode]], string: AnyStr, flags: int = ...) -> Optional[Match[AnyStr]]: ...
  49  @overload
  50  def split(pattern: Union[str, unicode], string: AnyStr, maxsplit: int = ..., flags: int = ...) -> List[AnyStr]: ...
  51  @overload
  52  def split(
  53      pattern: Union[Pattern[str], Pattern[unicode]], string: AnyStr, maxsplit: int = ..., flags: int = ...
  54  ) -> List[AnyStr]: ...
  55  @overload
  56  def findall(pattern: Union[str, unicode], string: AnyStr, flags: int = ...) -> List[Any]: ...
  57  @overload
  58  def findall(pattern: Union[Pattern[str], Pattern[unicode]], string: AnyStr, flags: int = ...) -> List[Any]: ...
  59  
  60  # Return an iterator yielding match objects over all non-overlapping matches
  61  # for the RE pattern in string. The string is scanned left-to-right, and
  62  # matches are returned in the order found. Empty matches are included in the
  63  # result unless they touch the beginning of another match.
  64  @overload
  65  def finditer(pattern: Union[str, unicode], string: AnyStr, flags: int = ...) -> Iterator[Match[AnyStr]]: ...
  66  @overload
  67  def finditer(pattern: Union[Pattern[str], Pattern[unicode]], string: AnyStr, flags: int = ...) -> Iterator[Match[AnyStr]]: ...
  68  @overload
  69  def sub(pattern: Union[str, unicode], repl: AnyStr, string: AnyStr, count: int = ..., flags: int = ...) -> AnyStr: ...
  70  @overload
  71  def sub(
  72      pattern: Union[str, unicode], repl: Callable[[Match[AnyStr]], AnyStr], string: AnyStr, count: int = ..., flags: int = ...
  73  ) -> AnyStr: ...
  74  @overload
  75  def sub(
  76      pattern: Union[Pattern[str], Pattern[unicode]], repl: AnyStr, string: AnyStr, count: int = ..., flags: int = ...
  77  ) -> AnyStr: ...
  78  @overload
  79  def sub(
  80      pattern: Union[Pattern[str], Pattern[unicode]],
  81      repl: Callable[[Match[AnyStr]], AnyStr],
  82      string: AnyStr,
  83      count: int = ...,
  84      flags: int = ...,
  85  ) -> AnyStr: ...
  86  @overload
  87  def subn(
  88      pattern: Union[str, unicode], repl: AnyStr, string: AnyStr, count: int = ..., flags: int = ...
  89  ) -> Tuple[AnyStr, int]: ...
  90  @overload
  91  def subn(
  92      pattern: Union[str, unicode], repl: Callable[[Match[AnyStr]], AnyStr], string: AnyStr, count: int = ..., flags: int = ...
  93  ) -> Tuple[AnyStr, int]: ...
  94  @overload
  95  def subn(
  96      pattern: Union[Pattern[str], Pattern[unicode]], repl: AnyStr, string: AnyStr, count: int = ..., flags: int = ...
  97  ) -> Tuple[AnyStr, int]: ...
  98  @overload
  99  def subn(
 100      pattern: Union[Pattern[str], Pattern[unicode]],
 101      repl: Callable[[Match[AnyStr]], AnyStr],
 102      string: AnyStr,
 103      count: int = ...,
 104      flags: int = ...,
 105  ) -> Tuple[AnyStr, int]: ...
 106  def escape(string: AnyStr) -> AnyStr: ...
 107  def purge() -> None: ...
 108  def template(pattern: Union[AnyStr, Pattern[AnyStr]], flags: int = ...) -> Pattern[AnyStr]: ...
 109