Format: application/octet-stream
⬇ Download File (3.3 KB)
   1  import sys
   2  from _typeshed import AnyPath
   3  from typing import Any, Optional, Pattern
   4  
   5  if sys.version_info >= (3, 7):
   6      from py_compile import PycInvalidationMode
   7  
   8  if sys.version_info >= (3, 9):
   9      def compile_dir(
  10          dir: AnyPath,
  11          maxlevels: Optional[int] = ...,
  12          ddir: Optional[AnyPath] = ...,
  13          force: bool = ...,
  14          rx: Optional[Pattern[Any]] = ...,
  15          quiet: int = ...,
  16          legacy: bool = ...,
  17          optimize: int = ...,
  18          workers: int = ...,
  19          invalidation_mode: Optional[PycInvalidationMode] = ...,
  20          *,
  21          stripdir: Optional[str] = ...,  # TODO: change to Optional[AnyPath] once https://bugs.python.org/issue40447 is resolved
  22          prependdir: Optional[AnyPath] = ...,
  23          limit_sl_dest: Optional[AnyPath] = ...,
  24          hardlink_dupes: bool = ...,
  25      ) -> int: ...
  26      def compile_file(
  27          fullname: AnyPath,
  28          ddir: Optional[AnyPath] = ...,
  29          force: bool = ...,
  30          rx: Optional[Pattern[Any]] = ...,
  31          quiet: int = ...,
  32          legacy: bool = ...,
  33          optimize: int = ...,
  34          invalidation_mode: Optional[PycInvalidationMode] = ...,
  35          *,
  36          stripdir: Optional[str] = ...,  # TODO: change to Optional[AnyPath] once https://bugs.python.org/issue40447 is resolved
  37          prependdir: Optional[AnyPath] = ...,
  38          limit_sl_dest: Optional[AnyPath] = ...,
  39          hardlink_dupes: bool = ...,
  40      ) -> int: ...
  41  
  42  elif sys.version_info >= (3, 7):
  43      def compile_dir(
  44          dir: AnyPath,
  45          maxlevels: int = ...,
  46          ddir: Optional[AnyPath] = ...,
  47          force: bool = ...,
  48          rx: Optional[Pattern[Any]] = ...,
  49          quiet: int = ...,
  50          legacy: bool = ...,
  51          optimize: int = ...,
  52          workers: int = ...,
  53          invalidation_mode: Optional[PycInvalidationMode] = ...,
  54      ) -> int: ...
  55      def compile_file(
  56          fullname: AnyPath,
  57          ddir: Optional[AnyPath] = ...,
  58          force: bool = ...,
  59          rx: Optional[Pattern[Any]] = ...,
  60          quiet: int = ...,
  61          legacy: bool = ...,
  62          optimize: int = ...,
  63          invalidation_mode: Optional[PycInvalidationMode] = ...,
  64      ) -> int: ...
  65  
  66  else:
  67      # rx can be any object with a 'search' method; once we have Protocols we can change the type
  68      def compile_dir(
  69          dir: AnyPath,
  70          maxlevels: int = ...,
  71          ddir: Optional[AnyPath] = ...,
  72          force: bool = ...,
  73          rx: Optional[Pattern[Any]] = ...,
  74          quiet: int = ...,
  75          legacy: bool = ...,
  76          optimize: int = ...,
  77          workers: int = ...,
  78      ) -> int: ...
  79      def compile_file(
  80          fullname: AnyPath,
  81          ddir: Optional[AnyPath] = ...,
  82          force: bool = ...,
  83          rx: Optional[Pattern[Any]] = ...,
  84          quiet: int = ...,
  85          legacy: bool = ...,
  86          optimize: int = ...,
  87      ) -> int: ...
  88  
  89  if sys.version_info >= (3, 7):
  90      def compile_path(
  91          skip_curdir: bool = ...,
  92          maxlevels: int = ...,
  93          force: bool = ...,
  94          quiet: int = ...,
  95          legacy: bool = ...,
  96          optimize: int = ...,
  97          invalidation_mode: Optional[PycInvalidationMode] = ...,
  98      ) -> int: ...
  99  
 100  else:
 101      def compile_path(
 102          skip_curdir: bool = ...,
 103          maxlevels: int = ...,
 104          force: bool = ...,
 105          quiet: int = ...,
 106          legacy: bool = ...,
 107          optimize: int = ...,
 108      ) -> int: ...
 109