Format: application/octet-stream
⬇ Download File (53.2 KB)
   1  import sys
   2  from _typeshed import (
   3      AnyPath,
   4      OpenBinaryMode,
   5      OpenBinaryModeReading,
   6      OpenBinaryModeUpdating,
   7      OpenBinaryModeWriting,
   8      OpenTextMode,
   9      ReadableBuffer,
  10      SupportsKeysAndGetItem,
  11      SupportsLessThan,
  12      SupportsLessThanT,
  13      SupportsWrite,
  14  )
  15  from ast import AST, mod
  16  from io import BufferedRandom, BufferedReader, BufferedWriter, FileIO, TextIOWrapper
  17  from types import CodeType, TracebackType
  18  from typing import (
  19      IO,
  20      AbstractSet,
  21      Any,
  22      BinaryIO,
  23      ByteString,
  24      Callable,
  25      Container,
  26      Dict,
  27      FrozenSet,
  28      Generic,
  29      ItemsView,
  30      Iterable,
  31      Iterator,
  32      KeysView,
  33      List,
  34      Mapping,
  35      MutableMapping,
  36      MutableSequence,
  37      MutableSet,
  38      NoReturn,
  39      Optional,
  40      Protocol,
  41      Reversible,
  42      Sequence,
  43      Set,
  44      Sized,
  45      SupportsAbs,
  46      SupportsBytes,
  47      SupportsComplex,
  48      SupportsFloat,
  49      SupportsInt,
  50      SupportsRound,
  51      Tuple,
  52      Type,
  53      TypeVar,
  54      Union,
  55      ValuesView,
  56      overload,
  57      runtime_checkable,
  58  )
  59  from typing_extensions import Literal
  60  
  61  if sys.version_info >= (3, 9):
  62      from types import GenericAlias
  63  
  64  class _SupportsIndex(Protocol):
  65      def __index__(self) -> int: ...
  66  
  67  class _SupportsTrunc(Protocol):
  68      def __trunc__(self) -> int: ...
  69  
  70  _T = TypeVar("_T")
  71  _T_co = TypeVar("_T_co", covariant=True)
  72  _KT = TypeVar("_KT")
  73  _VT = TypeVar("_VT")
  74  _S = TypeVar("_S")
  75  _T1 = TypeVar("_T1")
  76  _T2 = TypeVar("_T2")
  77  _T3 = TypeVar("_T3")
  78  _T4 = TypeVar("_T4")
  79  _T5 = TypeVar("_T5")
  80  _TT = TypeVar("_TT", bound="type")
  81  _TBE = TypeVar("_TBE", bound="BaseException")
  82  
  83  class object:
  84      __doc__: Optional[str]
  85      __dict__: Dict[str, Any]
  86      __slots__: Union[str, Iterable[str]]
  87      __module__: str
  88      __annotations__: Dict[str, Any]
  89      @property
  90      def __class__(self: _T) -> Type[_T]: ...
  91      @__class__.setter
  92      def __class__(self, __type: Type[object]) -> None: ...  # noqa: F811
  93      def __init__(self) -> None: ...
  94      def __new__(cls) -> Any: ...
  95      def __setattr__(self, name: str, value: Any) -> None: ...
  96      def __eq__(self, o: object) -> bool: ...
  97      def __ne__(self, o: object) -> bool: ...
  98      def __str__(self) -> str: ...
  99      def __repr__(self) -> str: ...
 100      def __hash__(self) -> int: ...
 101      def __format__(self, format_spec: str) -> str: ...
 102      def __getattribute__(self, name: str) -> Any: ...
 103      def __delattr__(self, name: str) -> None: ...
 104      def __sizeof__(self) -> int: ...
 105      def __reduce__(self) -> Union[str, Tuple[Any, ...]]: ...
 106      def __reduce_ex__(self, protocol: int) -> Union[str, Tuple[Any, ...]]: ...
 107      def __dir__(self) -> Iterable[str]: ...
 108      def __init_subclass__(cls) -> None: ...
 109  
 110  class staticmethod(object):  # Special, only valid as a decorator.
 111      __func__: Callable[..., Any]
 112      __isabstractmethod__: bool
 113      def __init__(self, f: Callable[..., Any]) -> None: ...
 114      def __new__(cls: Type[_T], *args: Any, **kwargs: Any) -> _T: ...
 115      def __get__(self, obj: _T, type: Optional[Type[_T]] = ...) -> Callable[..., Any]: ...
 116  
 117  class classmethod(object):  # Special, only valid as a decorator.
 118      __func__: Callable[..., Any]
 119      __isabstractmethod__: bool
 120      def __init__(self, f: Callable[..., Any]) -> None: ...
 121      def __new__(cls: Type[_T], *args: Any, **kwargs: Any) -> _T: ...
 122      def __get__(self, obj: _T, type: Optional[Type[_T]] = ...) -> Callable[..., Any]: ...
 123  
 124  class type(object):
 125      __base__: type
 126      __bases__: Tuple[type, ...]
 127      __basicsize__: int
 128      __dict__: Dict[str, Any]
 129      __dictoffset__: int
 130      __flags__: int
 131      __itemsize__: int
 132      __module__: str
 133      __mro__: Tuple[type, ...]
 134      __name__: str
 135      __qualname__: str
 136      __text_signature__: Optional[str]
 137      __weakrefoffset__: int
 138      @overload
 139      def __init__(self, o: object) -> None: ...
 140      @overload
 141      def __init__(self, name: str, bases: Tuple[type, ...], dict: Dict[str, Any]) -> None: ...
 142      @overload
 143      def __new__(cls, o: object) -> type: ...
 144      @overload
 145      def __new__(cls, name: str, bases: Tuple[type, ...], namespace: Dict[str, Any]) -> type: ...
 146      def __call__(self, *args: Any, **kwds: Any) -> Any: ...
 147      def __subclasses__(self: _TT) -> List[_TT]: ...
 148      # Note: the documentation doesnt specify what the return type is, the standard
 149      # implementation seems to be returning a list.
 150      def mro(self) -> List[type]: ...
 151      def __instancecheck__(self, instance: Any) -> bool: ...
 152      def __subclasscheck__(self, subclass: type) -> bool: ...
 153      @classmethod
 154      def __prepare__(metacls, __name: str, __bases: Tuple[type, ...], **kwds: Any) -> Mapping[str, Any]: ...
 155  
 156  class super(object):
 157      @overload
 158      def __init__(self, t: Any, obj: Any) -> None: ...
 159      @overload
 160      def __init__(self, t: Any) -> None: ...
 161      @overload
 162      def __init__(self) -> None: ...
 163  
 164  class int:
 165      @overload
 166      def __new__(cls: Type[_T], x: Union[str, bytes, SupportsInt, _SupportsIndex, _SupportsTrunc] = ...) -> _T: ...
 167      @overload
 168      def __new__(cls: Type[_T], x: Union[str, bytes, bytearray], base: int) -> _T: ...
 169      @overload
 170      def __init__(self, x: Union[str, bytes, SupportsInt, _SupportsIndex, _SupportsTrunc] = ...) -> _T: ...
 171      @overload
 172      def __init__(self, x: Union[str, bytes, bytearray], base: int) -> _T: ...
 173      if sys.version_info >= (3, 8):
 174          def as_integer_ratio(self) -> Tuple[int, Literal[1]]: ...
 175      @property
 176      def real(self) -> int: ...
 177      @property
 178      def imag(self) -> int: ...
 179      @property
 180      def numerator(self) -> int: ...
 181      @property
 182      def denominator(self) -> int: ...
 183      def conjugate(self) -> int: ...
 184      def bit_length(self) -> int: ...
 185      def to_bytes(self, length: int, byteorder: str, *, signed: bool = ...) -> bytes: ...
 186      @classmethod
 187      def from_bytes(
 188          cls, bytes: Union[Iterable[int], SupportsBytes], byteorder: str, *, signed: bool = ...
 189      ) -> int: ...  # TODO buffer object argument
 190      def __add__(self, x: int) -> int: ...
 191      def __sub__(self, x: int) -> int: ...
 192      def __mul__(self, x: int) -> int: ...
 193      def __floordiv__(self, x: int) -> int: ...
 194      def __truediv__(self, x: int) -> float: ...
 195      def __mod__(self, x: int) -> int: ...
 196      def __divmod__(self, x: int) -> Tuple[int, int]: ...
 197      def __radd__(self, x: int) -> int: ...
 198      def __rsub__(self, x: int) -> int: ...
 199      def __rmul__(self, x: int) -> int: ...
 200      def __rfloordiv__(self, x: int) -> int: ...
 201      def __rtruediv__(self, x: int) -> float: ...
 202      def __rmod__(self, x: int) -> int: ...
 203      def __rdivmod__(self, x: int) -> Tuple[int, int]: ...
 204      @overload
 205      def __pow__(self, __x: Literal[2], __modulo: Optional[int] = ...) -> int: ...
 206      @overload
 207      def __pow__(self, __x: int, __modulo: Optional[int] = ...) -> Any: ...  # Return type can be int or float, depending on x.
 208      def __rpow__(self, x: int, mod: Optional[int] = ...) -> Any: ...
 209      def __and__(self, n: int) -> int: ...
 210      def __or__(self, n: int) -> int: ...
 211      def __xor__(self, n: int) -> int: ...
 212      def __lshift__(self, n: int) -> int: ...
 213      def __rshift__(self, n: int) -> int: ...
 214      def __rand__(self, n: int) -> int: ...
 215      def __ror__(self, n: int) -> int: ...
 216      def __rxor__(self, n: int) -> int: ...
 217      def __rlshift__(self, n: int) -> int: ...
 218      def __rrshift__(self, n: int) -> int: ...
 219      def __neg__(self) -> int: ...
 220      def __pos__(self) -> int: ...
 221      def __invert__(self) -> int: ...
 222      def __trunc__(self) -> int: ...
 223      def __ceil__(self) -> int: ...
 224      def __floor__(self) -> int: ...
 225      def __round__(self, ndigits: Optional[int] = ...) -> int: ...
 226      def __getnewargs__(self) -> Tuple[int]: ...
 227      def __eq__(self, x: object) -> bool: ...
 228      def __ne__(self, x: object) -> bool: ...
 229      def __lt__(self, x: int) -> bool: ...
 230      def __le__(self, x: int) -> bool: ...
 231      def __gt__(self, x: int) -> bool: ...
 232      def __ge__(self, x: int) -> bool: ...
 233      def __str__(self) -> str: ...
 234      def __float__(self) -> float: ...
 235      def __int__(self) -> int: ...
 236      def __abs__(self) -> int: ...
 237      def __hash__(self) -> int: ...
 238      def __bool__(self) -> bool: ...
 239      def __index__(self) -> int: ...
 240  
 241  class float:
 242      def __new__(cls: Type[_T], x: Union[SupportsFloat, _SupportsIndex, str, bytes, bytearray] = ...) -> _T: ...
 243      def as_integer_ratio(self) -> Tuple[int, int]: ...
 244      def hex(self) -> str: ...
 245      def is_integer(self) -> bool: ...
 246      @classmethod
 247      def fromhex(cls, __s: str) -> float: ...
 248      @property
 249      def real(self) -> float: ...
 250      @property
 251      def imag(self) -> float: ...
 252      def conjugate(self) -> float: ...
 253      def __add__(self, x: float) -> float: ...
 254      def __sub__(self, x: float) -> float: ...
 255      def __mul__(self, x: float) -> float: ...
 256      def __floordiv__(self, x: float) -> float: ...
 257      def __truediv__(self, x: float) -> float: ...
 258      def __mod__(self, x: float) -> float: ...
 259      def __divmod__(self, x: float) -> Tuple[float, float]: ...
 260      def __pow__(
 261          self, x: float, mod: None = ...
 262      ) -> float: ...  # In Python 3, returns complex if self is negative and x is not whole
 263      def __radd__(self, x: float) -> float: ...
 264      def __rsub__(self, x: float) -> float: ...
 265      def __rmul__(self, x: float) -> float: ...
 266      def __rfloordiv__(self, x: float) -> float: ...
 267      def __rtruediv__(self, x: float) -> float: ...
 268      def __rmod__(self, x: float) -> float: ...
 269      def __rdivmod__(self, x: float) -> Tuple[float, float]: ...
 270      def __rpow__(self, x: float, mod: None = ...) -> float: ...
 271      def __getnewargs__(self) -> Tuple[float]: ...
 272      def __trunc__(self) -> int: ...
 273      if sys.version_info >= (3, 9):
 274          def __ceil__(self) -> int: ...
 275          def __floor__(self) -> int: ...
 276      @overload
 277      def __round__(self, ndigits: None = ...) -> int: ...
 278      @overload
 279      def __round__(self, ndigits: int) -> float: ...
 280      def __eq__(self, x: object) -> bool: ...
 281      def __ne__(self, x: object) -> bool: ...
 282      def __lt__(self, x: float) -> bool: ...
 283      def __le__(self, x: float) -> bool: ...
 284      def __gt__(self, x: float) -> bool: ...
 285      def __ge__(self, x: float) -> bool: ...
 286      def __neg__(self) -> float: ...
 287      def __pos__(self) -> float: ...
 288      def __str__(self) -> str: ...
 289      def __int__(self) -> int: ...
 290      def __float__(self) -> float: ...
 291      def __abs__(self) -> float: ...
 292      def __hash__(self) -> int: ...
 293      def __bool__(self) -> bool: ...
 294  
 295  class complex:
 296      @overload
 297      def __new__(cls: Type[_T], real: float = ..., imag: float = ...) -> _T: ...
 298      @overload
 299      def __new__(cls: Type[_T], real: Union[str, SupportsComplex, _SupportsIndex]) -> _T: ...
 300      @property
 301      def real(self) -> float: ...
 302      @property
 303      def imag(self) -> float: ...
 304      def conjugate(self) -> complex: ...
 305      def __add__(self, x: complex) -> complex: ...
 306      def __sub__(self, x: complex) -> complex: ...
 307      def __mul__(self, x: complex) -> complex: ...
 308      def __pow__(self, x: complex, mod: None = ...) -> complex: ...
 309      def __truediv__(self, x: complex) -> complex: ...
 310      def __radd__(self, x: complex) -> complex: ...
 311      def __rsub__(self, x: complex) -> complex: ...
 312      def __rmul__(self, x: complex) -> complex: ...
 313      def __rpow__(self, x: complex, mod: None = ...) -> complex: ...
 314      def __rtruediv__(self, x: complex) -> complex: ...
 315      def __eq__(self, x: object) -> bool: ...
 316      def __ne__(self, x: object) -> bool: ...
 317      def __neg__(self) -> complex: ...
 318      def __pos__(self) -> complex: ...
 319      def __str__(self) -> str: ...
 320      def __complex__(self) -> complex: ...
 321      def __abs__(self) -> float: ...
 322      def __hash__(self) -> int: ...
 323      def __bool__(self) -> bool: ...
 324  
 325  class _FormatMapMapping(Protocol):
 326      def __getitem__(self, __key: str) -> Any: ...
 327  
 328  class str(Sequence[str]):
 329      @overload
 330      def __new__(cls: Type[_T], o: object = ...) -> _T: ...
 331      @overload
 332      def __new__(cls: Type[_T], o: bytes, encoding: str = ..., errors: str = ...) -> _T: ...
 333      @overload
 334      def __init__(self, o: object = ...) -> _T: ...
 335      @overload
 336      def __init__(self, o: bytes, encoding: str = ..., errors: str = ...) -> _T: ...
 337      def capitalize(self) -> str: ...
 338      def casefold(self) -> str: ...
 339      def center(self, __width: int, __fillchar: str = ...) -> str: ...
 340      def count(self, x: str, __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ...
 341      def encode(self, encoding: str = ..., errors: str = ...) -> bytes: ...
 342      def endswith(self, suffix: Union[str, Tuple[str, ...]], start: Optional[int] = ..., end: Optional[int] = ...) -> bool: ...
 343      def expandtabs(self, tabsize: int = ...) -> str: ...
 344      def find(self, sub: str, __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ...
 345      def format(self, *args: object, **kwargs: object) -> str: ...
 346      def format_map(self, map: _FormatMapMapping) -> str: ...
 347      def index(self, sub: str, __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ...
 348      def isalnum(self) -> bool: ...
 349      def isalpha(self) -> bool: ...
 350      if sys.version_info >= (3, 7):
 351          def isascii(self) -> bool: ...
 352      def isdecimal(self) -> bool: ...
 353      def isdigit(self) -> bool: ...
 354      def isidentifier(self) -> bool: ...
 355      def islower(self) -> bool: ...
 356      def isnumeric(self) -> bool: ...
 357      def isprintable(self) -> bool: ...
 358      def isspace(self) -> bool: ...
 359      def istitle(self) -> bool: ...
 360      def isupper(self) -> bool: ...
 361      def join(self, __iterable: Iterable[str]) -> str: ...
 362      def ljust(self, __width: int, __fillchar: str = ...) -> str: ...
 363      def lower(self) -> str: ...
 364      def lstrip(self, __chars: Optional[str] = ...) -> str: ...
 365      def partition(self, __sep: str) -> Tuple[str, str, str]: ...
 366      def replace(self, __old: str, __new: str, __count: int = ...) -> str: ...
 367      if sys.version_info >= (3, 9):
 368          def removeprefix(self, __prefix: str) -> str: ...
 369          def removesuffix(self, __suffix: str) -> str: ...
 370      def rfind(self, sub: str, __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ...
 371      def rindex(self, sub: str, __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ...
 372      def rjust(self, __width: int, __fillchar: str = ...) -> str: ...
 373      def rpartition(self, __sep: str) -> Tuple[str, str, str]: ...
 374      def rsplit(self, sep: Optional[str] = ..., maxsplit: int = ...) -> List[str]: ...
 375      def rstrip(self, __chars: Optional[str] = ...) -> str: ...
 376      def split(self, sep: Optional[str] = ..., maxsplit: int = ...) -> List[str]: ...
 377      def splitlines(self, keepends: bool = ...) -> List[str]: ...
 378      def startswith(self, prefix: Union[str, Tuple[str, ...]], start: Optional[int] = ..., end: Optional[int] = ...) -> bool: ...
 379      def strip(self, __chars: Optional[str] = ...) -> str: ...
 380      def swapcase(self) -> str: ...
 381      def title(self) -> str: ...
 382      def translate(self, __table: Union[Mapping[int, Union[int, str, None]], Sequence[Union[int, str, None]]]) -> str: ...
 383      def upper(self) -> str: ...
 384      def zfill(self, __width: int) -> str: ...
 385      @staticmethod
 386      @overload
 387      def maketrans(__x: Union[Dict[int, _T], Dict[str, _T], Dict[Union[str, int], _T]]) -> Dict[int, _T]: ...
 388      @staticmethod
 389      @overload
 390      def maketrans(__x: str, __y: str, __z: Optional[str] = ...) -> Dict[int, Union[int, None]]: ...
 391      def __add__(self, s: str) -> str: ...
 392      # Incompatible with Sequence.__contains__
 393      def __contains__(self, o: str) -> bool: ...  # type: ignore
 394      def __eq__(self, x: object) -> bool: ...
 395      def __ge__(self, x: str) -> bool: ...
 396      def __getitem__(self, i: Union[int, slice]) -> str: ...
 397      def __gt__(self, x: str) -> bool: ...
 398      def __hash__(self) -> int: ...
 399      def __iter__(self) -> Iterator[str]: ...
 400      def __le__(self, x: str) -> bool: ...
 401      def __len__(self) -> int: ...
 402      def __lt__(self, x: str) -> bool: ...
 403      def __mod__(self, x: Any) -> str: ...
 404      def __mul__(self, n: int) -> str: ...
 405      def __ne__(self, x: object) -> bool: ...
 406      def __repr__(self) -> str: ...
 407      def __rmul__(self, n: int) -> str: ...
 408      def __str__(self) -> str: ...
 409      def __getnewargs__(self) -> Tuple[str]: ...
 410  
 411  class bytes(ByteString):
 412      @overload
 413      def __new__(cls: Type[_T], ints: Iterable[int]) -> _T: ...
 414      @overload
 415      def __new__(cls: Type[_T], string: str, encoding: str, errors: str = ...) -> _T: ...
 416      @overload
 417      def __new__(cls: Type[_T], length: int) -> _T: ...
 418      @overload
 419      def __new__(cls: Type[_T]) -> _T: ...
 420      @overload
 421      def __new__(cls: Type[_T], o: SupportsBytes) -> _T: ...
 422      def capitalize(self) -> bytes: ...
 423      def center(self, __width: int, __fillchar: bytes = ...) -> bytes: ...
 424      def count(self, sub: Union[bytes, int], start: Optional[int] = ..., end: Optional[int] = ...) -> int: ...
 425      def decode(self, encoding: str = ..., errors: str = ...) -> str: ...
 426      def endswith(self, suffix: Union[bytes, Tuple[bytes, ...]]) -> bool: ...
 427      def expandtabs(self, tabsize: int = ...) -> bytes: ...
 428      def find(self, sub: Union[bytes, int], start: Optional[int] = ..., end: Optional[int] = ...) -> int: ...
 429      if sys.version_info >= (3, 8):
 430          def hex(self, sep: Union[str, bytes] = ..., bytes_per_sep: int = ...) -> str: ...
 431      else:
 432          def hex(self) -> str: ...
 433      def index(self, sub: Union[bytes, int], start: Optional[int] = ..., end: Optional[int] = ...) -> int: ...
 434      def isalnum(self) -> bool: ...
 435      def isalpha(self) -> bool: ...
 436      if sys.version_info >= (3, 7):
 437          def isascii(self) -> bool: ...
 438      def isdigit(self) -> bool: ...
 439      def islower(self) -> bool: ...
 440      def isspace(self) -> bool: ...
 441      def istitle(self) -> bool: ...
 442      def isupper(self) -> bool: ...
 443      def join(self, __iterable_of_bytes: Iterable[Union[ByteString, memoryview]]) -> bytes: ...
 444      def ljust(self, __width: int, __fillchar: bytes = ...) -> bytes: ...
 445      def lower(self) -> bytes: ...
 446      def lstrip(self, __bytes: Optional[bytes] = ...) -> bytes: ...
 447      def partition(self, __sep: bytes) -> Tuple[bytes, bytes, bytes]: ...
 448      def replace(self, __old: bytes, __new: bytes, __count: int = ...) -> bytes: ...
 449      if sys.version_info >= (3, 9):
 450          def removeprefix(self, __prefix: bytes) -> bytes: ...
 451          def removesuffix(self, __suffix: bytes) -> bytes: ...
 452      def rfind(self, sub: Union[bytes, int], start: Optional[int] = ..., end: Optional[int] = ...) -> int: ...
 453      def rindex(self, sub: Union[bytes, int], start: Optional[int] = ..., end: Optional[int] = ...) -> int: ...
 454      def rjust(self, __width: int, __fillchar: bytes = ...) -> bytes: ...
 455      def rpartition(self, __sep: bytes) -> Tuple[bytes, bytes, bytes]: ...
 456      def rsplit(self, sep: Optional[bytes] = ..., maxsplit: int = ...) -> List[bytes]: ...
 457      def rstrip(self, __bytes: Optional[bytes] = ...) -> bytes: ...
 458      def split(self, sep: Optional[bytes] = ..., maxsplit: int = ...) -> List[bytes]: ...
 459      def splitlines(self, keepends: bool = ...) -> List[bytes]: ...
 460      def startswith(
 461          self, prefix: Union[bytes, Tuple[bytes, ...]], start: Optional[int] = ..., end: Optional[int] = ...
 462      ) -> bool: ...
 463      def strip(self, __bytes: Optional[bytes] = ...) -> bytes: ...
 464      def swapcase(self) -> bytes: ...
 465      def title(self) -> bytes: ...
 466      def translate(self, __table: Optional[bytes], delete: bytes = ...) -> bytes: ...
 467      def upper(self) -> bytes: ...
 468      def zfill(self, __width: int) -> bytes: ...
 469      @classmethod
 470      def fromhex(cls, __s: str) -> bytes: ...
 471      @classmethod
 472      def maketrans(cls, frm: bytes, to: bytes) -> bytes: ...
 473      def __len__(self) -> int: ...
 474      def __iter__(self) -> Iterator[int]: ...
 475      def __str__(self) -> str: ...
 476      def __repr__(self) -> str: ...
 477      def __int__(self) -> int: ...
 478      def __float__(self) -> float: ...
 479      def __hash__(self) -> int: ...
 480      @overload
 481      def __getitem__(self, i: int) -> int: ...
 482      @overload
 483      def __getitem__(self, s: slice) -> bytes: ...
 484      def __add__(self, s: bytes) -> bytes: ...
 485      def __mul__(self, n: int) -> bytes: ...
 486      def __rmul__(self, n: int) -> bytes: ...
 487      def __mod__(self, value: Any) -> bytes: ...
 488      # Incompatible with Sequence.__contains__
 489      def __contains__(self, o: Union[int, bytes]) -> bool: ...  # type: ignore
 490      def __eq__(self, x: object) -> bool: ...
 491      def __ne__(self, x: object) -> bool: ...
 492      def __lt__(self, x: bytes) -> bool: ...
 493      def __le__(self, x: bytes) -> bool: ...
 494      def __gt__(self, x: bytes) -> bool: ...
 495      def __ge__(self, x: bytes) -> bool: ...
 496      def __getnewargs__(self) -> Tuple[bytes]: ...
 497  
 498  class bytearray(MutableSequence[int], ByteString):
 499      @overload
 500      def __init__(self) -> None: ...
 501      @overload
 502      def __init__(self, ints: Iterable[int]) -> None: ...
 503      @overload
 504      def __init__(self, string: str, encoding: str, errors: str = ...) -> None: ...
 505      @overload
 506      def __init__(self, length: int) -> None: ...
 507      def capitalize(self) -> bytearray: ...
 508      def center(self, __width: int, __fillchar: bytes = ...) -> bytearray: ...
 509      def count(self, __sub: Union[bytes, int], __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ...
 510      def copy(self) -> bytearray: ...
 511      def decode(self, encoding: str = ..., errors: str = ...) -> str: ...
 512      def endswith(self, __suffix: Union[bytes, Tuple[bytes, ...]]) -> bool: ...
 513      def expandtabs(self, tabsize: int = ...) -> bytearray: ...
 514      def find(self, __sub: Union[bytes, int], __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ...
 515      def hex(self) -> str: ...
 516      def index(self, __sub: Union[bytes, int], __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ...
 517      def insert(self, __index: int, __item: int) -> None: ...
 518      def isalnum(self) -> bool: ...
 519      def isalpha(self) -> bool: ...
 520      if sys.version_info >= (3, 7):
 521          def isascii(self) -> bool: ...
 522      def isdigit(self) -> bool: ...
 523      def islower(self) -> bool: ...
 524      def isspace(self) -> bool: ...
 525      def istitle(self) -> bool: ...
 526      def isupper(self) -> bool: ...
 527      def join(self, __iterable_of_bytes: Iterable[Union[ByteString, memoryview]]) -> bytearray: ...
 528      def ljust(self, __width: int, __fillchar: bytes = ...) -> bytearray: ...
 529      def lower(self) -> bytearray: ...
 530      def lstrip(self, __bytes: Optional[bytes] = ...) -> bytearray: ...
 531      def partition(self, __sep: bytes) -> Tuple[bytearray, bytearray, bytearray]: ...
 532      if sys.version_info >= (3, 9):
 533          def removeprefix(self, __prefix: bytes) -> bytearray: ...
 534          def removesuffix(self, __suffix: bytes) -> bytearray: ...
 535      def replace(self, __old: bytes, __new: bytes, __count: int = ...) -> bytearray: ...
 536      def rfind(self, __sub: Union[bytes, int], __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ...
 537      def rindex(self, __sub: Union[bytes, int], __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ...
 538      def rjust(self, __width: int, __fillchar: bytes = ...) -> bytearray: ...
 539      def rpartition(self, __sep: bytes) -> Tuple[bytearray, bytearray, bytearray]: ...
 540      def rsplit(self, sep: Optional[bytes] = ..., maxsplit: int = ...) -> List[bytearray]: ...
 541      def rstrip(self, __bytes: Optional[bytes] = ...) -> bytearray: ...
 542      def split(self, sep: Optional[bytes] = ..., maxsplit: int = ...) -> List[bytearray]: ...
 543      def splitlines(self, keepends: bool = ...) -> List[bytearray]: ...
 544      def startswith(
 545          self, __prefix: Union[bytes, Tuple[bytes, ...]], __start: Optional[int] = ..., __end: Optional[int] = ...
 546      ) -> bool: ...
 547      def strip(self, __bytes: Optional[bytes] = ...) -> bytearray: ...
 548      def swapcase(self) -> bytearray: ...
 549      def title(self) -> bytearray: ...
 550      def translate(self, __table: Optional[bytes], delete: bytes = ...) -> bytearray: ...
 551      def upper(self) -> bytearray: ...
 552      def zfill(self, __width: int) -> bytearray: ...
 553      @classmethod
 554      def fromhex(cls, __string: str) -> bytearray: ...
 555      @classmethod
 556      def maketrans(cls, __frm: bytes, __to: bytes) -> bytes: ...
 557      def __len__(self) -> int: ...
 558      def __iter__(self) -> Iterator[int]: ...
 559      def __str__(self) -> str: ...
 560      def __repr__(self) -> str: ...
 561      def __int__(self) -> int: ...
 562      def __float__(self) -> float: ...
 563      __hash__: None  # type: ignore
 564      @overload
 565      def __getitem__(self, i: int) -> int: ...
 566      @overload
 567      def __getitem__(self, s: slice) -> bytearray: ...
 568      @overload
 569      def __setitem__(self, i: int, x: int) -> None: ...
 570      @overload
 571      def __setitem__(self, s: slice, x: Union[Iterable[int], bytes]) -> None: ...
 572      def __delitem__(self, i: Union[int, slice]) -> None: ...
 573      def __add__(self, s: bytes) -> bytearray: ...
 574      def __iadd__(self, s: Iterable[int]) -> bytearray: ...
 575      def __mul__(self, n: int) -> bytearray: ...
 576      def __rmul__(self, n: int) -> bytearray: ...
 577      def __imul__(self, n: int) -> bytearray: ...
 578      def __mod__(self, value: Any) -> bytes: ...
 579      # Incompatible with Sequence.__contains__
 580      def __contains__(self, o: Union[int, bytes]) -> bool: ...  # type: ignore
 581      def __eq__(self, x: object) -> bool: ...
 582      def __ne__(self, x: object) -> bool: ...
 583      def __lt__(self, x: bytes) -> bool: ...
 584      def __le__(self, x: bytes) -> bool: ...
 585      def __gt__(self, x: bytes) -> bool: ...
 586      def __ge__(self, x: bytes) -> bool: ...
 587  
 588  class memoryview(Sized, Container[int]):
 589      format: str
 590      itemsize: int
 591      shape: Optional[Tuple[int, ...]]
 592      strides: Optional[Tuple[int, ...]]
 593      suboffsets: Optional[Tuple[int, ...]]
 594      readonly: bool
 595      ndim: int
 596  
 597      obj: Union[bytes, bytearray]
 598      c_contiguous: bool
 599      f_contiguous: bool
 600      contiguous: bool
 601      nbytes: int
 602      def __init__(self, obj: ReadableBuffer) -> None: ...
 603      def __enter__(self) -> memoryview: ...
 604      def __exit__(
 605          self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]
 606      ) -> None: ...
 607      def cast(self, format: str, shape: Union[List[int], Tuple[int]] = ...) -> memoryview: ...
 608      @overload
 609      def __getitem__(self, i: int) -> int: ...
 610      @overload
 611      def __getitem__(self, s: slice) -> memoryview: ...
 612      def __contains__(self, x: object) -> bool: ...
 613      def __iter__(self) -> Iterator[int]: ...
 614      def __len__(self) -> int: ...
 615      @overload
 616      def __setitem__(self, s: slice, o: memoryview) -> None: ...
 617      @overload
 618      def __setitem__(self, i: int, o: bytes) -> None: ...
 619      @overload
 620      def __setitem__(self, s: slice, o: Sequence[bytes]) -> None: ...
 621      if sys.version_info >= (3, 8):
 622          def tobytes(self, order: Optional[Literal["C", "F", "A"]] = ...) -> bytes: ...
 623      else:
 624          def tobytes(self) -> bytes: ...
 625      def tolist(self) -> List[int]: ...
 626      if sys.version_info >= (3, 8):
 627          def toreadonly(self) -> memoryview: ...
 628      def release(self) -> None: ...
 629      def hex(self) -> str: ...
 630  
 631  class bool(int):
 632      def __new__(cls: Type[_T], __o: object = ...) -> _T: ...
 633      def __init__(self, o: object = ...): ...
 634      @overload
 635      def __and__(self, x: bool) -> bool: ...
 636      @overload
 637      def __and__(self, x: int) -> int: ...
 638      @overload
 639      def __or__(self, x: bool) -> bool: ...
 640      @overload
 641      def __or__(self, x: int) -> int: ...
 642      @overload
 643      def __xor__(self, x: bool) -> bool: ...
 644      @overload
 645      def __xor__(self, x: int) -> int: ...
 646      @overload
 647      def __rand__(self, x: bool) -> bool: ...
 648      @overload
 649      def __rand__(self, x: int) -> int: ...
 650      @overload
 651      def __ror__(self, x: bool) -> bool: ...
 652      @overload
 653      def __ror__(self, x: int) -> int: ...
 654      @overload
 655      def __rxor__(self, x: bool) -> bool: ...
 656      @overload
 657      def __rxor__(self, x: int) -> int: ...
 658      def __getnewargs__(self) -> Tuple[int]: ...
 659  
 660  class slice(object):
 661      start: Any
 662      step: Any
 663      stop: Any
 664      @overload
 665      def __init__(self, stop: Any) -> None: ...
 666      @overload
 667      def __init__(self, start: Any, stop: Any, step: Any = ...) -> None: ...
 668      __hash__: None  # type: ignore
 669      def indices(self, len: int) -> Tuple[int, int, int]: ...
 670  
 671  class tuple(Sequence[_T_co], Generic[_T_co]):
 672      def __new__(cls: Type[_T], iterable: Iterable[_T_co] = ...) -> _T: ...
 673      def __init__(self, iterable: Iterable[_T_co] = ...): ...
 674      def __len__(self) -> int: ...
 675      def __contains__(self, x: object) -> bool: ...
 676      @overload
 677      def __getitem__(self, x: int) -> _T_co: ...
 678      @overload
 679      def __getitem__(self, x: slice) -> Tuple[_T_co, ...]: ...
 680      def __iter__(self) -> Iterator[_T_co]: ...
 681      def __lt__(self, x: Tuple[_T_co, ...]) -> bool: ...
 682      def __le__(self, x: Tuple[_T_co, ...]) -> bool: ...
 683      def __gt__(self, x: Tuple[_T_co, ...]) -> bool: ...
 684      def __ge__(self, x: Tuple[_T_co, ...]) -> bool: ...
 685      @overload
 686      def __add__(self, x: Tuple[_T_co, ...]) -> Tuple[_T_co, ...]: ...
 687      @overload
 688      def __add__(self, x: Tuple[Any, ...]) -> Tuple[Any, ...]: ...
 689      def __mul__(self, n: int) -> Tuple[_T_co, ...]: ...
 690      def __rmul__(self, n: int) -> Tuple[_T_co, ...]: ...
 691      def count(self, __value: Any) -> int: ...
 692      def index(self, __value: Any, __start: int = ..., __stop: int = ...) -> int: ...
 693      if sys.version_info >= (3, 9):
 694          def __class_getitem__(cls, item: Any) -> GenericAlias: ...
 695  
 696  class list(MutableSequence[_T], Generic[_T]):
 697      @overload
 698      def __init__(self) -> None: ...
 699      @overload
 700      def __init__(self, iterable: Iterable[_T]) -> None: ...
 701      def clear(self) -> None: ...
 702      def copy(self) -> List[_T]: ...
 703      def append(self, __object: _T) -> None: ...
 704      def extend(self, __iterable: Iterable[_T]) -> None: ...
 705      def pop(self, __index: int = ...) -> _T: ...
 706      def index(self, __value: _T, __start: int = ..., __stop: int = ...) -> int: ...
 707      def count(self, __value: _T) -> int: ...
 708      def insert(self, __index: int, __object: _T) -> None: ...
 709      def remove(self, __value: _T) -> None: ...
 710      def reverse(self) -> None: ...
 711      @overload
 712      def sort(self: List[SupportsLessThanT], *, key: None = ..., reverse: bool = ...) -> None: ...
 713      @overload
 714      def sort(self, *, key: Callable[[_T], SupportsLessThan], reverse: bool = ...) -> None: ...
 715      def __len__(self) -> int: ...
 716      def __iter__(self) -> Iterator[_T]: ...
 717      def __str__(self) -> str: ...
 718      __hash__: None  # type: ignore
 719      @overload
 720      def __getitem__(self, i: int) -> _T: ...
 721      @overload
 722      def __getitem__(self, s: slice) -> List[_T]: ...
 723      @overload
 724      def __setitem__(self, i: int, o: _T) -> None: ...
 725      @overload
 726      def __setitem__(self, s: slice, o: Iterable[_T]) -> None: ...
 727      def __delitem__(self, i: Union[int, slice]) -> None: ...
 728      def __add__(self, x: List[_T]) -> List[_T]: ...
 729      def __iadd__(self: _S, x: Iterable[_T]) -> _S: ...
 730      def __mul__(self, n: int) -> List[_T]: ...
 731      def __rmul__(self, n: int) -> List[_T]: ...
 732      def __imul__(self: _S, n: int) -> _S: ...
 733      def __contains__(self, o: object) -> bool: ...
 734      def __reversed__(self) -> Iterator[_T]: ...
 735      def __gt__(self, x: List[_T]) -> bool: ...
 736      def __ge__(self, x: List[_T]) -> bool: ...
 737      def __lt__(self, x: List[_T]) -> bool: ...
 738      def __le__(self, x: List[_T]) -> bool: ...
 739      if sys.version_info >= (3, 9):
 740          def __class_getitem__(cls, item: Any) -> GenericAlias: ...
 741  
 742  class dict(MutableMapping[_KT, _VT], Generic[_KT, _VT]):
 743      # NOTE: Keyword arguments are special. If they are used, _KT must include
 744      #       str, but we have no way of enforcing it here.
 745      @overload
 746      def __init__(self, **kwargs: _VT) -> None: ...
 747      @overload
 748      def __init__(self, map: Mapping[_KT, _VT], **kwargs: _VT) -> None: ...
 749      @overload
 750      def __init__(self, iterable: Iterable[Tuple[_KT, _VT]], **kwargs: _VT) -> None: ...
 751      def __new__(cls: Type[_T1], *args: Any, **kwargs: Any) -> _T1: ...
 752      def clear(self) -> None: ...
 753      def copy(self) -> Dict[_KT, _VT]: ...
 754      def popitem(self) -> Tuple[_KT, _VT]: ...
 755      def setdefault(self, __key: _KT, __default: _VT = ...) -> _VT: ...
 756      @overload
 757      def update(self, __m: Mapping[_KT, _VT], **kwargs: _VT) -> None: ...
 758      @overload
 759      def update(self, __m: Iterable[Tuple[_KT, _VT]], **kwargs: _VT) -> None: ...
 760      @overload
 761      def update(self, **kwargs: _VT) -> None: ...
 762      def keys(self) -> KeysView[_KT]: ...
 763      def values(self) -> ValuesView[_VT]: ...
 764      def items(self) -> ItemsView[_KT, _VT]: ...
 765      @classmethod
 766      @overload
 767      def fromkeys(cls, __iterable: Iterable[_T]) -> Dict[_T, Any]: ...
 768      @classmethod
 769      @overload
 770      def fromkeys(cls, __iterable: Iterable[_T], __value: _S) -> Dict[_T, _S]: ...
 771      def __len__(self) -> int: ...
 772      def __getitem__(self, k: _KT) -> _VT: ...
 773      def __setitem__(self, k: _KT, v: _VT) -> None: ...
 774      def __delitem__(self, v: _KT) -> None: ...
 775      def __iter__(self) -> Iterator[_KT]: ...
 776      if sys.version_info >= (3, 8):
 777          def __reversed__(self) -> Iterator[_KT]: ...
 778      def __str__(self) -> str: ...
 779      __hash__: None  # type: ignore
 780      if sys.version_info >= (3, 9):
 781          def __class_getitem__(cls, item: Any) -> GenericAlias: ...
 782          def __or__(self, __value: Mapping[_KT, _VT]) -> Dict[_KT, _VT]: ...
 783          def __ior__(self, __value: Mapping[_KT, _VT]) -> Dict[_KT, _VT]: ...
 784  
 785  class set(MutableSet[_T], Generic[_T]):
 786      def __init__(self, iterable: Iterable[_T] = ...) -> None: ...
 787      def add(self, element: _T) -> None: ...
 788      def clear(self) -> None: ...
 789      def copy(self) -> Set[_T]: ...
 790      def difference(self, *s: Iterable[Any]) -> Set[_T]: ...
 791      def difference_update(self, *s: Iterable[Any]) -> None: ...
 792      def discard(self, element: _T) -> None: ...
 793      def intersection(self, *s: Iterable[Any]) -> Set[_T]: ...
 794      def intersection_update(self, *s: Iterable[Any]) -> None: ...
 795      def isdisjoint(self, s: Iterable[Any]) -> bool: ...
 796      def issubset(self, s: Iterable[Any]) -> bool: ...
 797      def issuperset(self, s: Iterable[Any]) -> bool: ...
 798      def pop(self) -> _T: ...
 799      def remove(self, element: _T) -> None: ...
 800      def symmetric_difference(self, s: Iterable[_T]) -> Set[_T]: ...
 801      def symmetric_difference_update(self, s: Iterable[_T]) -> None: ...
 802      def union(self, *s: Iterable[_T]) -> Set[_T]: ...
 803      def update(self, *s: Iterable[_T]) -> None: ...
 804      def __len__(self) -> int: ...
 805      def __contains__(self, o: object) -> bool: ...
 806      def __iter__(self) -> Iterator[_T]: ...
 807      def __str__(self) -> str: ...
 808      def __and__(self, s: AbstractSet[object]) -> Set[_T]: ...
 809      def __iand__(self, s: AbstractSet[object]) -> Set[_T]: ...
 810      def __or__(self, s: AbstractSet[_S]) -> Set[Union[_T, _S]]: ...
 811      def __ior__(self, s: AbstractSet[_S]) -> Set[Union[_T, _S]]: ...
 812      def __sub__(self, s: AbstractSet[Optional[_T]]) -> Set[_T]: ...
 813      def __isub__(self, s: AbstractSet[Optional[_T]]) -> Set[_T]: ...
 814      def __xor__(self, s: AbstractSet[_S]) -> Set[Union[_T, _S]]: ...
 815      def __ixor__(self, s: AbstractSet[_S]) -> Set[Union[_T, _S]]: ...
 816      def __le__(self, s: AbstractSet[object]) -> bool: ...
 817      def __lt__(self, s: AbstractSet[object]) -> bool: ...
 818      def __ge__(self, s: AbstractSet[object]) -> bool: ...
 819      def __gt__(self, s: AbstractSet[object]) -> bool: ...
 820      __hash__: None  # type: ignore
 821      if sys.version_info >= (3, 9):
 822          def __class_getitem__(cls, item: Any) -> GenericAlias: ...
 823  
 824  class frozenset(AbstractSet[_T_co], Generic[_T_co]):
 825      def __init__(self, iterable: Iterable[_T_co] = ...) -> None: ...
 826      def copy(self) -> FrozenSet[_T_co]: ...
 827      def difference(self, *s: Iterable[object]) -> FrozenSet[_T_co]: ...
 828      def intersection(self, *s: Iterable[object]) -> FrozenSet[_T_co]: ...
 829      def isdisjoint(self, s: Iterable[_T_co]) -> bool: ...
 830      def issubset(self, s: Iterable[object]) -> bool: ...
 831      def issuperset(self, s: Iterable[object]) -> bool: ...
 832      def symmetric_difference(self, s: Iterable[_T_co]) -> FrozenSet[_T_co]: ...
 833      def union(self, *s: Iterable[_T_co]) -> FrozenSet[_T_co]: ...
 834      def __len__(self) -> int: ...
 835      def __contains__(self, o: object) -> bool: ...
 836      def __iter__(self) -> Iterator[_T_co]: ...
 837      def __str__(self) -> str: ...
 838      def __and__(self, s: AbstractSet[_T_co]) -> FrozenSet[_T_co]: ...
 839      def __or__(self, s: AbstractSet[_S]) -> FrozenSet[Union[_T_co, _S]]: ...
 840      def __sub__(self, s: AbstractSet[_T_co]) -> FrozenSet[_T_co]: ...
 841      def __xor__(self, s: AbstractSet[_S]) -> FrozenSet[Union[_T_co, _S]]: ...
 842      def __le__(self, s: AbstractSet[object]) -> bool: ...
 843      def __lt__(self, s: AbstractSet[object]) -> bool: ...
 844      def __ge__(self, s: AbstractSet[object]) -> bool: ...
 845      def __gt__(self, s: AbstractSet[object]) -> bool: ...
 846      if sys.version_info >= (3, 9):
 847          def __class_getitem__(cls, item: Any) -> GenericAlias: ...
 848  
 849  class enumerate(Iterator[Tuple[int, _T]], Generic[_T]):
 850      def __init__(self, iterable: Iterable[_T], start: int = ...) -> None: ...
 851      def __iter__(self) -> Iterator[Tuple[int, _T]]: ...
 852      def __next__(self) -> Tuple[int, _T]: ...
 853      if sys.version_info >= (3, 9):
 854          def __class_getitem__(cls, item: Any) -> GenericAlias: ...
 855  
 856  class range(Sequence[int]):
 857      start: int
 858      stop: int
 859      step: int
 860      @overload
 861      def __init__(self, stop: int) -> None: ...
 862      @overload
 863      def __init__(self, start: int, stop: int, step: int = ...) -> None: ...
 864      def count(self, value: int) -> int: ...
 865      def index(self, value: int) -> int: ...  # type: ignore
 866      def __len__(self) -> int: ...
 867      def __contains__(self, o: object) -> bool: ...
 868      def __iter__(self) -> Iterator[int]: ...
 869      @overload
 870      def __getitem__(self, i: int) -> int: ...
 871      @overload
 872      def __getitem__(self, s: slice) -> range: ...
 873      def __repr__(self) -> str: ...
 874      def __reversed__(self) -> Iterator[int]: ...
 875  
 876  class property(object):
 877      def __init__(
 878          self,
 879          fget: Optional[Callable[[Any], Any]] = ...,
 880          fset: Optional[Callable[[Any, Any], None]] = ...,
 881          fdel: Optional[Callable[[Any], None]] = ...,
 882          doc: Optional[str] = ...,
 883      ) -> None: ...
 884      def getter(self, fget: Callable[[Any], Any]) -> property: ...
 885      def setter(self, fset: Callable[[Any, Any], None]) -> property: ...
 886      def deleter(self, fdel: Callable[[Any], None]) -> property: ...
 887      def __get__(self, obj: Any, type: Optional[type] = ...) -> Any: ...
 888      def __set__(self, obj: Any, value: Any) -> None: ...
 889      def __delete__(self, obj: Any) -> None: ...
 890      def fget(self) -> Any: ...
 891      def fset(self, value: Any) -> None: ...
 892      def fdel(self) -> None: ...
 893  
 894  class _NotImplementedType(Any):  # type: ignore
 895      # A little weird, but typing the __call__ as NotImplemented makes the error message
 896      # for NotImplemented() much better
 897      pass
 898  
 899  NotImplemented: _NotImplementedType
 900  
 901  def abs(__x: SupportsAbs[_T]) -> _T: ...
 902  def all(__iterable: Iterable[object]) -> bool: ...
 903  def any(__iterable: Iterable[object]) -> bool: ...
 904  def ascii(__obj: object) -> str: ...
 905  def bin(__number: Union[int, _SupportsIndex]) -> str: ...
 906  
 907  if sys.version_info >= (3, 7):
 908      def breakpoint(*args: Any, **kws: Any) -> None: ...
 909  
 910  def callable(__obj: object) -> bool: ...
 911  def chr(__i: int) -> str: ...
 912  
 913  # This class is to be exported as PathLike from os,
 914  # but we define it here as _PathLike to avoid import cycle issues.
 915  # See https://github.com/python/typeshed/pull/991#issuecomment-288160993
 916  _AnyStr_co = TypeVar("_AnyStr_co", str, bytes, covariant=True)
 917  @runtime_checkable
 918  class _PathLike(Protocol[_AnyStr_co]):
 919      def __fspath__(self) -> _AnyStr_co: ...
 920  
 921  if sys.version_info >= (3, 8):
 922      def compile(
 923          source: Union[str, bytes, mod, AST],
 924          filename: Union[str, bytes, _PathLike[Any]],
 925          mode: str,
 926          flags: int = ...,
 927          dont_inherit: int = ...,
 928          optimize: int = ...,
 929          *,
 930          _feature_version: int = ...,
 931      ) -> Any: ...
 932  
 933  else:
 934      def compile(
 935          source: Union[str, bytes, mod, AST],
 936          filename: Union[str, bytes, _PathLike[Any]],
 937          mode: str,
 938          flags: int = ...,
 939          dont_inherit: int = ...,
 940          optimize: int = ...,
 941      ) -> Any: ...
 942  
 943  def copyright() -> None: ...
 944  def credits() -> None: ...
 945  def delattr(__obj: Any, __name: str) -> None: ...
 946  def dir(__o: object = ...) -> List[str]: ...
 947  
 948  _N2 = TypeVar("_N2", int, float)
 949  
 950  def divmod(__x: _N2, __y: _N2) -> Tuple[_N2, _N2]: ...
 951  def eval(
 952      __source: Union[str, bytes, CodeType], __globals: Optional[Dict[str, Any]] = ..., __locals: Optional[Mapping[str, Any]] = ...
 953  ) -> Any: ...
 954  def exec(
 955      __source: Union[str, bytes, CodeType],
 956      __globals: Optional[Dict[str, Any]] = ...,
 957      __locals: Optional[Mapping[str, Any]] = ...,
 958  ) -> Any: ...
 959  def exit(code: object = ...) -> NoReturn: ...
 960  @overload
 961  def filter(__function: None, __iterable: Iterable[Optional[_T]]) -> Iterator[_T]: ...
 962  @overload
 963  def filter(__function: Callable[[_T], Any], __iterable: Iterable[_T]) -> Iterator[_T]: ...
 964  def format(__value: object, __format_spec: str = ...) -> str: ...  # TODO unicode
 965  def getattr(__o: Any, name: str, __default: Any = ...) -> Any: ...
 966  def globals() -> Dict[str, Any]: ...
 967  def hasattr(__obj: Any, __name: str) -> bool: ...
 968  def hash(__obj: object) -> int: ...
 969  def help(*args: Any, **kwds: Any) -> None: ...
 970  def hex(__number: Union[int, _SupportsIndex]) -> str: ...
 971  def id(__obj: object) -> int: ...
 972  def input(__prompt: Any = ...) -> str: ...
 973  @overload
 974  def iter(__iterable: Iterable[_T]) -> Iterator[_T]: ...
 975  @overload
 976  def iter(__function: Callable[[], Optional[_T]], __sentinel: None) -> Iterator[_T]: ...
 977  @overload
 978  def iter(__function: Callable[[], _T], __sentinel: Any) -> Iterator[_T]: ...
 979  def isinstance(__obj: object, __class_or_tuple: Union[type, Tuple[Union[type, Tuple[Any, ...]], ...]]) -> bool: ...
 980  def issubclass(__cls: type, __class_or_tuple: Union[type, Tuple[Union[type, Tuple[Any, ...]], ...]]) -> bool: ...
 981  def len(__obj: Sized) -> int: ...
 982  def license() -> None: ...
 983  def locals() -> Dict[str, Any]: ...
 984  @overload
 985  def map(__func: Callable[[_T1], _S], __iter1: Iterable[_T1]) -> Iterator[_S]: ...
 986  @overload
 987  def map(__func: Callable[[_T1, _T2], _S], __iter1: Iterable[_T1], __iter2: Iterable[_T2]) -> Iterator[_S]: ...
 988  @overload
 989  def map(
 990      __func: Callable[[_T1, _T2, _T3], _S], __iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3]
 991  ) -> Iterator[_S]: ...
 992  @overload
 993  def map(
 994      __func: Callable[[_T1, _T2, _T3, _T4], _S],
 995      __iter1: Iterable[_T1],
 996      __iter2: Iterable[_T2],
 997      __iter3: Iterable[_T3],
 998      __iter4: Iterable[_T4],
 999  ) -> Iterator[_S]: ...
1000  @overload
1001  def map(
1002      __func: Callable[[_T1, _T2, _T3, _T4, _T5], _S],
1003      __iter1: Iterable[_T1],
1004      __iter2: Iterable[_T2],
1005      __iter3: Iterable[_T3],
1006      __iter4: Iterable[_T4],
1007      __iter5: Iterable[_T5],
1008  ) -> Iterator[_S]: ...
1009  @overload
1010  def map(
1011      __func: Callable[..., _S],
1012      __iter1: Iterable[Any],
1013      __iter2: Iterable[Any],
1014      __iter3: Iterable[Any],
1015      __iter4: Iterable[Any],
1016      __iter5: Iterable[Any],
1017      __iter6: Iterable[Any],
1018      *iterables: Iterable[Any],
1019  ) -> Iterator[_S]: ...
1020  @overload
1021  def max(
1022      __arg1: SupportsLessThanT, __arg2: SupportsLessThanT, *_args: SupportsLessThanT, key: None = ...
1023  ) -> SupportsLessThanT: ...
1024  @overload
1025  def max(__arg1: _T, __arg2: _T, *_args: _T, key: Callable[[_T], SupportsLessThanT]) -> _T: ...
1026  @overload
1027  def max(__iterable: Iterable[SupportsLessThanT], *, key: None = ...) -> SupportsLessThanT: ...
1028  @overload
1029  def max(__iterable: Iterable[_T], *, key: Callable[[_T], SupportsLessThanT]) -> _T: ...
1030  @overload
1031  def max(__iterable: Iterable[SupportsLessThanT], *, key: None = ..., default: _T) -> Union[SupportsLessThanT, _T]: ...
1032  @overload
1033  def max(__iterable: Iterable[_T1], *, key: Callable[[_T1], SupportsLessThanT], default: _T2) -> Union[_T1, _T2]: ...
1034  @overload
1035  def min(
1036      __arg1: SupportsLessThanT, __arg2: SupportsLessThanT, *_args: SupportsLessThanT, key: None = ...
1037  ) -> SupportsLessThanT: ...
1038  @overload
1039  def min(__arg1: _T, __arg2: _T, *_args: _T, key: Callable[[_T], SupportsLessThanT]) -> _T: ...
1040  @overload
1041  def min(__iterable: Iterable[SupportsLessThanT], *, key: None = ...) -> SupportsLessThanT: ...
1042  @overload
1043  def min(__iterable: Iterable[_T], *, key: Callable[[_T], SupportsLessThanT]) -> _T: ...
1044  @overload
1045  def min(__iterable: Iterable[SupportsLessThanT], *, key: None = ..., default: _T) -> Union[SupportsLessThanT, _T]: ...
1046  @overload
1047  def min(__iterable: Iterable[_T1], *, key: Callable[[_T1], SupportsLessThanT], default: _T2) -> Union[_T1, _T2]: ...
1048  @overload
1049  def next(__i: Iterator[_T]) -> _T: ...
1050  @overload
1051  def next(__i: Iterator[_T], default: _VT) -> Union[_T, _VT]: ...
1052  def oct(__number: Union[int, _SupportsIndex]) -> str: ...
1053  
1054  _OpenFile = Union[AnyPath, int]
1055  _Opener = Callable[[str, int], int]
1056  
1057  # Text mode: always returns a TextIOWrapper
1058  @overload
1059  def open(
1060      file: _OpenFile,
1061      mode: OpenTextMode = ...,
1062      buffering: int = ...,
1063      encoding: Optional[str] = ...,
1064      errors: Optional[str] = ...,
1065      newline: Optional[str] = ...,
1066      closefd: bool = ...,
1067      opener: Optional[_Opener] = ...,
1068  ) -> TextIOWrapper: ...
1069  
1070  # Unbuffered binary mode: returns a FileIO
1071  @overload
1072  def open(
1073      file: _OpenFile,
1074      mode: OpenBinaryMode,
1075      buffering: Literal[0],
1076      encoding: None = ...,
1077      errors: None = ...,
1078      newline: None = ...,
1079      closefd: bool = ...,
1080      opener: Optional[_Opener] = ...,
1081  ) -> FileIO: ...
1082  
1083  # Buffering is on: return BufferedRandom, BufferedReader, or BufferedWriter
1084  @overload
1085  def open(
1086      file: _OpenFile,
1087      mode: OpenBinaryModeUpdating,
1088      buffering: Literal[-1, 1] = ...,
1089      encoding: None = ...,
1090      errors: None = ...,
1091      newline: None = ...,
1092      closefd: bool = ...,
1093      opener: Optional[_Opener] = ...,
1094  ) -> BufferedRandom: ...
1095  @overload
1096  def open(
1097      file: _OpenFile,
1098      mode: OpenBinaryModeWriting,
1099      buffering: Literal[-1, 1] = ...,
1100      encoding: None = ...,
1101      errors: None = ...,
1102      newline: None = ...,
1103      closefd: bool = ...,
1104      opener: Optional[_Opener] = ...,
1105  ) -> BufferedWriter: ...
1106  @overload
1107  def open(
1108      file: _OpenFile,
1109      mode: OpenBinaryModeReading,
1110      buffering: Literal[-1, 1] = ...,
1111      encoding: None = ...,
1112      errors: None = ...,
1113      newline: None = ...,
1114      closefd: bool = ...,
1115      opener: Optional[_Opener] = ...,
1116  ) -> BufferedReader: ...
1117  
1118  # Buffering cannot be determined: fall back to BinaryIO
1119  @overload
1120  def open(
1121      file: _OpenFile,
1122      mode: OpenBinaryMode,
1123      buffering: int,
1124      encoding: None = ...,
1125      errors: None = ...,
1126      newline: None = ...,
1127      closefd: bool = ...,
1128      opener: Optional[_Opener] = ...,
1129  ) -> BinaryIO: ...
1130  
1131  # Fallback if mode is not specified
1132  @overload
1133  def open(
1134      file: _OpenFile,
1135      mode: str,
1136      buffering: int = ...,
1137      encoding: Optional[str] = ...,
1138      errors: Optional[str] = ...,
1139      newline: Optional[str] = ...,
1140      closefd: bool = ...,
1141      opener: Optional[_Opener] = ...,
1142  ) -> IO[Any]: ...
1143  def ord(__c: Union[str, bytes]) -> int: ...
1144  def print(
1145      *values: object,
1146      sep: Optional[str] = ...,
1147      end: Optional[str] = ...,
1148      file: Optional[SupportsWrite[str]] = ...,
1149      flush: bool = ...,
1150  ) -> None: ...
1151  
1152  _E = TypeVar("_E", contravariant=True)
1153  _M = TypeVar("_M", contravariant=True)
1154  
1155  class _SupportsPow2(Protocol[_E, _T_co]):
1156      def __pow__(self, __other: _E) -> _T_co: ...
1157  
1158  class _SupportsPow3(Protocol[_E, _M, _T_co]):
1159      def __pow__(self, __other: _E, __modulo: _M) -> _T_co: ...
1160  
1161  if sys.version_info >= (3, 8):
1162      @overload
1163      def pow(base: int, exp: int, mod: None = ...) -> Any: ...  # returns int or float depending on whether exp is non-negative
1164      @overload
1165      def pow(base: int, exp: int, mod: int) -> int: ...
1166      @overload
1167      def pow(base: float, exp: float, mod: None = ...) -> float: ...
1168      @overload
1169      def pow(base: _SupportsPow2[_E, _T_co], exp: _E) -> _T_co: ...
1170      @overload
1171      def pow(base: _SupportsPow3[_E, _M, _T_co], exp: _E, mod: _M) -> _T_co: ...
1172  
1173  else:
1174      @overload
1175      def pow(
1176          __base: int, __exp: int, __mod: None = ...
1177      ) -> Any: ...  # returns int or float depending on whether exp is non-negative
1178      @overload
1179      def pow(__base: int, __exp: int, __mod: int) -> int: ...
1180      @overload
1181      def pow(__base: float, __exp: float, __mod: None = ...) -> float: ...
1182      @overload
1183      def pow(__base: _SupportsPow2[_E, _T_co], __exp: _E) -> _T_co: ...
1184      @overload
1185      def pow(__base: _SupportsPow3[_E, _M, _T_co], __exp: _E, __mod: _M) -> _T_co: ...
1186  
1187  def quit(code: object = ...) -> NoReturn: ...
1188  @overload
1189  def reversed(__sequence: Sequence[_T]) -> Iterator[_T]: ...
1190  @overload
1191  def reversed(__sequence: Reversible[_T]) -> Iterator[_T]: ...
1192  def repr(__obj: object) -> str: ...
1193  @overload
1194  def round(number: float) -> int: ...
1195  @overload
1196  def round(number: float, ndigits: None) -> int: ...
1197  @overload
1198  def round(number: float, ndigits: int) -> float: ...
1199  @overload
1200  def round(number: SupportsRound[_T]) -> int: ...
1201  @overload
1202  def round(number: SupportsRound[_T], ndigits: None) -> int: ...
1203  @overload
1204  def round(number: SupportsRound[_T], ndigits: int) -> _T: ...
1205  def setattr(__obj: Any, __name: str, __value: Any) -> None: ...
1206  @overload
1207  def sorted(__iterable: Iterable[SupportsLessThanT], *, key: None = ..., reverse: bool = ...) -> List[SupportsLessThanT]: ...
1208  @overload
1209  def sorted(__iterable: Iterable[_T], *, key: Callable[[_T], SupportsLessThan], reverse: bool = ...) -> List[_T]: ...
1210  
1211  if sys.version_info >= (3, 8):
1212      @overload
1213      def sum(__iterable: Iterable[_T]) -> Union[_T, int]: ...
1214      @overload
1215      def sum(__iterable: Iterable[_T], start: _S) -> Union[_T, _S]: ...
1216  
1217  else:
1218      @overload
1219      def sum(__iterable: Iterable[_T]) -> Union[_T, int]: ...
1220      @overload
1221      def sum(__iterable: Iterable[_T], __start: _S) -> Union[_T, _S]: ...
1222  
1223  def vars(__object: Any = ...) -> Dict[str, Any]: ...
1224  @overload
1225  def zip(__iter1: Iterable[_T1]) -> Iterator[Tuple[_T1]]: ...
1226  @overload
1227  def zip(__iter1: Iterable[_T1], __iter2: Iterable[_T2]) -> Iterator[Tuple[_T1, _T2]]: ...
1228  @overload
1229  def zip(__iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3]) -> Iterator[Tuple[_T1, _T2, _T3]]: ...
1230  @overload
1231  def zip(
1232      __iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3], __iter4: Iterable[_T4]
1233  ) -> Iterator[Tuple[_T1, _T2, _T3, _T4]]: ...
1234  @overload
1235  def zip(
1236      __iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3], __iter4: Iterable[_T4], __iter5: Iterable[_T5]
1237  ) -> Iterator[Tuple[_T1, _T2, _T3, _T4, _T5]]: ...
1238  @overload
1239  def zip(
1240      __iter1: Iterable[Any],
1241      __iter2: Iterable[Any],
1242      __iter3: Iterable[Any],
1243      __iter4: Iterable[Any],
1244      __iter5: Iterable[Any],
1245      __iter6: Iterable[Any],
1246      *iterables: Iterable[Any],
1247  ) -> Iterator[Tuple[Any, ...]]: ...
1248  def __import__(
1249      name: str,
1250      globals: Optional[Mapping[str, Any]] = ...,
1251      locals: Optional[Mapping[str, Any]] = ...,
1252      fromlist: Sequence[str] = ...,
1253      level: int = ...,
1254  ) -> Any: ...
1255  
1256  # Actually the type of Ellipsis is <type 'ellipsis'>, but since it's
1257  # not exposed anywhere under that name, we make it private here.
1258  class ellipsis: ...
1259  
1260  Ellipsis: ellipsis
1261  
1262  class BaseException(object):
1263      args: Tuple[Any, ...]
1264      __cause__: Optional[BaseException]
1265      __context__: Optional[BaseException]
1266      __suppress_context__: bool
1267      __traceback__: Optional[TracebackType]
1268      def __init__(self, *args: object) -> None: ...
1269      def __str__(self) -> str: ...
1270      def __repr__(self) -> str: ...
1271      def with_traceback(self: _TBE, tb: Optional[TracebackType]) -> _TBE: ...
1272  
1273  class GeneratorExit(BaseException): ...
1274  class KeyboardInterrupt(BaseException): ...
1275  
1276  class SystemExit(BaseException):
1277      code: int
1278  
1279  class Exception(BaseException): ...
1280  
1281  class StopIteration(Exception):
1282      value: Any
1283  
1284  _StandardError = Exception
1285  
1286  class OSError(Exception):
1287      errno: int
1288      strerror: str
1289      # filename, filename2 are actually Union[str, bytes, None]
1290      filename: Any
1291      filename2: Any
1292  
1293  EnvironmentError = OSError
1294  IOError = OSError
1295  
1296  class ArithmeticError(_StandardError): ...
1297  class AssertionError(_StandardError): ...
1298  class AttributeError(_StandardError): ...
1299  class BufferError(_StandardError): ...
1300  class EOFError(_StandardError): ...
1301  
1302  class ImportError(_StandardError):
1303      def __init__(self, *args: object, name: Optional[str] = ..., path: Optional[str] = ...) -> None: ...
1304      name: Optional[str]
1305      path: Optional[str]
1306  
1307  class LookupError(_StandardError): ...
1308  class MemoryError(_StandardError): ...
1309  class NameError(_StandardError): ...
1310  class ReferenceError(_StandardError): ...
1311  class RuntimeError(_StandardError): ...
1312  
1313  class StopAsyncIteration(Exception):
1314      value: Any
1315  
1316  class SyntaxError(_StandardError):
1317      msg: str
1318      lineno: Optional[int]
1319      offset: Optional[int]
1320      text: Optional[str]
1321      filename: Optional[str]
1322  
1323  class SystemError(_StandardError): ...
1324  class TypeError(_StandardError): ...
1325  class ValueError(_StandardError): ...
1326  class FloatingPointError(ArithmeticError): ...
1327  class OverflowError(ArithmeticError): ...
1328  class ZeroDivisionError(ArithmeticError): ...
1329  class ModuleNotFoundError(ImportError): ...
1330  class IndexError(LookupError): ...
1331  class KeyError(LookupError): ...
1332  class UnboundLocalError(NameError): ...
1333  
1334  class WindowsError(OSError):
1335      winerror: int
1336  
1337  class BlockingIOError(OSError):
1338      characters_written: int
1339  
1340  class ChildProcessError(OSError): ...
1341  class ConnectionError(OSError): ...
1342  class BrokenPipeError(ConnectionError): ...
1343  class ConnectionAbortedError(ConnectionError): ...
1344  class ConnectionRefusedError(ConnectionError): ...
1345  class ConnectionResetError(ConnectionError): ...
1346  class FileExistsError(OSError): ...
1347  class FileNotFoundError(OSError): ...
1348  class InterruptedError(OSError): ...
1349  class IsADirectoryError(OSError): ...
1350  class NotADirectoryError(OSError): ...
1351  class PermissionError(OSError): ...
1352  class ProcessLookupError(OSError): ...
1353  class TimeoutError(OSError): ...
1354  class NotImplementedError(RuntimeError): ...
1355  class RecursionError(RuntimeError): ...
1356  class IndentationError(SyntaxError): ...
1357  class TabError(IndentationError): ...
1358  class UnicodeError(ValueError): ...
1359  
1360  class UnicodeDecodeError(UnicodeError):
1361      encoding: str
1362      object: bytes
1363      start: int
1364      end: int
1365      reason: str
1366      def __init__(self, __encoding: str, __object: bytes, __start: int, __end: int, __reason: str) -> None: ...
1367  
1368  class UnicodeEncodeError(UnicodeError):
1369      encoding: str
1370      object: str
1371      start: int
1372      end: int
1373      reason: str
1374      def __init__(self, __encoding: str, __object: str, __start: int, __end: int, __reason: str) -> None: ...
1375  
1376  class UnicodeTranslateError(UnicodeError): ...
1377  class Warning(Exception): ...
1378  class UserWarning(Warning): ...
1379  class DeprecationWarning(Warning): ...
1380  class SyntaxWarning(Warning): ...
1381  class RuntimeWarning(Warning): ...
1382  class FutureWarning(Warning): ...
1383  class PendingDeprecationWarning(Warning): ...
1384  class ImportWarning(Warning): ...
1385  class UnicodeWarning(Warning): ...
1386  class BytesWarning(Warning): ...
1387  class ResourceWarning(Warning): ...
1388