    # Note: the documentation doesnt specify what the return type is, the standard
    # implementation seems to be returning a list.
    
  # In Python 3, returns complex if self is negative and x is not whole

    # NOTE: Keyword arguments are special. If they are used, _KT must include
    #       str, but we have no way of enforcing it here.
    
    # A little weird, but typing the __call__ as NotImplemented makes the error message
    # for NotImplemented() much better
    
# This class is to be exported as PathLike from os,
# but we define it here as _PathLike to avoid import cycle issues.
# See https://github.com/python/typeshed/pull/991#issuecomment-288160993

# Buffering is on: return BufferedRandom, BufferedReader, or BufferedWriter

  # returns int or float depending on whether exp is non-negative

# Actually the type of Ellipsis is <type 'ellipsis'>, but since it's
# not exposed anywhere under that name, we make it private here.

    # filename, filename2 are actually Union[str, bytes, None]
    
from io import BufferedRandom, BufferedReader, BufferedWriter, FileIO, TextIOWrapper

    def __class__(self, __type: Type[object]) -> None: ...  # noqa: F811

    def __reduce_ex__(self, protocol: int) -> Union[str, Tuple[Any, ...]]: ...

class staticmethod(object):  # Special, only valid as a decorator.

    def __new__(cls: Type[_T], *args: Any, **kwargs: Any) -> _T: ...

    def __get__(self, obj: _T, type: Optional[Type[_T]] = ...) -> Callable[..., Any]: ...

class classmethod(object):  # Special, only valid as a decorator.

    def __init__(self, name: str, bases: Tuple[type, ...], dict: Dict[str, Any]) -> None: ...

    def __new__(cls, name: str, bases: Tuple[type, ...], namespace: Dict[str, Any]) -> type: ...

    def __prepare__(metacls, __name: str, __bases: Tuple[type, ...], **kwds: Any) -> Mapping[str, Any]: ...

    def __new__(cls: Type[_T], x: Union[str, bytes, SupportsInt, _SupportsIndex, _SupportsTrunc] = ...) -> _T: ...

    def __new__(cls: Type[_T], x: Union[str, bytes, bytearray], base: int) -> _T: ...

    def __init__(self, x: Union[str, bytes, SupportsInt, _SupportsIndex, _SupportsTrunc] = ...) -> _T: ...

    def __init__(self, x: Union[str, bytes, bytearray], base: int) -> _T: ...

        def as_integer_ratio(self) -> Tuple[int, Literal[1]]: ...

    def to_bytes(self, length: int, byteorder: str, *, signed: bool = ...) -> bytes: ...

        cls, bytes: Union[Iterable[int], SupportsBytes], byteorder: str, *, signed: bool = ...

    def __pow__(self, __x: Literal[2], __modulo: Optional[int] = ...) -> int: ...

    def __pow__(self, __x: int, __modulo: Optional[int] = ...) -> Any: ...  # Return type can be int or float, depending on x.

    def __rpow__(self, x: int, mod: Optional[int] = ...) -> Any: ...

    def __round__(self, ndigits: Optional[int] = ...) -> int: ...

    def __new__(cls: Type[_T], x: Union[SupportsFloat, _SupportsIndex, str, bytes, bytearray] = ...) -> _T: ...

    ) -> float: ...  # In Python 3, returns complex if self is negative and x is not whole

    def __rdivmod__(self, x: float) -> Tuple[float, float]: ...

    def __rpow__(self, x: float, mod: None = ...) -> float: ...

    def __new__(cls: Type[_T], real: float = ..., imag: float = ...) -> _T: ...

    def __new__(cls: Type[_T], real: Union[str, SupportsComplex, _SupportsIndex]) -> _T: ...

    def __pow__(self, x: complex, mod: None = ...) -> complex: ...

    def __rpow__(self, x: complex, mod: None = ...) -> complex: ...

    def __new__(cls: Type[_T], o: bytes, encoding: str = ..., errors: str = ...) -> _T: ...

    def __init__(self, o: bytes, encoding: str = ..., errors: str = ...) -> _T: ...

    def center(self, __width: int, __fillchar: str = ...) -> str: ...

    def count(self, x: str, __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ...

    def encode(self, encoding: str = ..., errors: str = ...) -> bytes: ...

    def endswith(self, suffix: Union[str, Tuple[str, ...]], start: Optional[int] = ..., end: Optional[int] = ...) -> bool: ...

    def find(self, sub: str, __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ...

    def format(self, *args: object, **kwargs: object) -> str: ...

    def index(self, sub: str, __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ...

    def ljust(self, __width: int, __fillchar: str = ...) -> str: ...

    def partition(self, __sep: str) -> Tuple[str, str, str]: ...

    def replace(self, __old: str, __new: str, __count: int = ...) -> str: ...

    def rfind(self, sub: str, __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ...

    def rindex(self, sub: str, __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ...

    def rjust(self, __width: int, __fillchar: str = ...) -> str: ...

    def rpartition(self, __sep: str) -> Tuple[str, str, str]: ...

    def rsplit(self, sep: Optional[str] = ..., maxsplit: int = ...) -> List[str]: ...

    def split(self, sep: Optional[str] = ..., maxsplit: int = ...) -> List[str]: ...

    def splitlines(self, keepends: bool = ...) -> List[str]: ...

    def startswith(self, prefix: Union[str, Tuple[str, ...]], start: Optional[int] = ..., end: Optional[int] = ...) -> bool: ...

    def translate(self, __table: Union[Mapping[int, Union[int, str, None]], Sequence[Union[int, str, None]]]) -> str: ...

    def maketrans(__x: Union[Dict[int, _T], Dict[str, _T], Dict[Union[str, int], _T]]) -> Dict[int, _T]: ...

    def maketrans(__x: str, __y: str, __z: Optional[str] = ...) -> Dict[int, Union[int, None]]: ...

    def __contains__(self, o: str) -> bool: ...  # type: ignore

    def __new__(cls: Type[_T], string: str, encoding: str, errors: str = ...) -> _T: ...

    def center(self, __width: int, __fillchar: bytes = ...) -> bytes: ...

    def count(self, sub: Union[bytes, int], start: Optional[int] = ..., end: Optional[int] = ...) -> int: ...

    def decode(self, encoding: str = ..., errors: str = ...) -> str: ...

    def endswith(self, suffix: Union[bytes, Tuple[bytes, ...]]) -> bool: ...

    def find(self, sub: Union[bytes, int], start: Optional[int] = ..., end: Optional[int] = ...) -> int: ...

        def hex(self, sep: Union[str, bytes] = ..., bytes_per_sep: int = ...) -> str: ...

    def index(self, sub: Union[bytes, int], start: Optional[int] = ..., end: Optional[int] = ...) -> int: ...

    def join(self, __iterable_of_bytes: Iterable[Union[ByteString, memoryview]]) -> bytes: ...

    def ljust(self, __width: int, __fillchar: bytes = ...) -> bytes: ...

    def lstrip(self, __bytes: Optional[bytes] = ...) -> bytes: ...

    def partition(self, __sep: bytes) -> Tuple[bytes, bytes, bytes]: ...

    def replace(self, __old: bytes, __new: bytes, __count: int = ...) -> bytes: ...

    def rfind(self, sub: Union[bytes, int], start: Optional[int] = ..., end: Optional[int] = ...) -> int: ...

    def rindex(self, sub: Union[bytes, int], start: Optional[int] = ..., end: Optional[int] = ...) -> int: ...

    def rjust(self, __width: int, __fillchar: bytes = ...) -> bytes: ...

    def rpartition(self, __sep: bytes) -> Tuple[bytes, bytes, bytes]: ...

    def rsplit(self, sep: Optional[bytes] = ..., maxsplit: int = ...) -> List[bytes]: ...

    def rstrip(self, __bytes: Optional[bytes] = ...) -> bytes: ...

    def split(self, sep: Optional[bytes] = ..., maxsplit: int = ...) -> List[bytes]: ...

    def splitlines(self, keepends: bool = ...) -> List[bytes]: ...

        self, prefix: Union[bytes, Tuple[bytes, ...]], start: Optional[int] = ..., end: Optional[int] = ...

    def strip(self, __bytes: Optional[bytes] = ...) -> bytes: ...

    def translate(self, __table: Optional[bytes], delete: bytes = ...) -> bytes: ...

    def __contains__(self, o: Union[int, bytes]) -> bool: ...  # type: ignore

    def __init__(self, string: str, encoding: str, errors: str = ...) -> None: ...

    def center(self, __width: int, __fillchar: bytes = ...) -> bytearray: ...

    def count(self, __sub: Union[bytes, int], __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ...

    def endswith(self, __suffix: Union[bytes, Tuple[bytes, ...]]) -> bool: ...

    def find(self, __sub: Union[bytes, int], __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ...

    def index(self, __sub: Union[bytes, int], __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ...

    def join(self, __iterable_of_bytes: Iterable[Union[ByteString, memoryview]]) -> bytearray: ...

    def ljust(self, __width: int, __fillchar: bytes = ...) -> bytearray: ...

    def lstrip(self, __bytes: Optional[bytes] = ...) -> bytearray: ...

    def partition(self, __sep: bytes) -> Tuple[bytearray, bytearray, bytearray]: ...

        def removeprefix(self, __prefix: bytes) -> bytearray: ...

        def removesuffix(self, __suffix: bytes) -> bytearray: ...

    def replace(self, __old: bytes, __new: bytes, __count: int = ...) -> bytearray: ...

    def rfind(self, __sub: Union[bytes, int], __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ...

    def rindex(self, __sub: Union[bytes, int], __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ...

    def rjust(self, __width: int, __fillchar: bytes = ...) -> bytearray: ...

    def rpartition(self, __sep: bytes) -> Tuple[bytearray, bytearray, bytearray]: ...

    def rsplit(self, sep: Optional[bytes] = ..., maxsplit: int = ...) -> List[bytearray]: ...

    def rstrip(self, __bytes: Optional[bytes] = ...) -> bytearray: ...

    def split(self, sep: Optional[bytes] = ..., maxsplit: int = ...) -> List[bytearray]: ...

    def splitlines(self, keepends: bool = ...) -> List[bytearray]: ...

        self, __prefix: Union[bytes, Tuple[bytes, ...]], __start: Optional[int] = ..., __end: Optional[int] = ...

    def strip(self, __bytes: Optional[bytes] = ...) -> bytearray: ...

    def translate(self, __table: Optional[bytes], delete: bytes = ...) -> bytearray: ...

    def maketrans(cls, __frm: bytes, __to: bytes) -> bytes: ...

    def __setitem__(self, s: slice, x: Union[Iterable[int], bytes]) -> None: ...

        self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]

    def cast(self, format: str, shape: Union[List[int], Tuple[int]] = ...) -> memoryview: ...

    def __setitem__(self, s: slice, o: memoryview) -> None: ...

    def __setitem__(self, s: slice, o: Sequence[bytes]) -> None: ...

        def tobytes(self, order: Optional[Literal["C", "F", "A"]] = ...) -> bytes: ...

    def __init__(self, start: Any, stop: Any, step: Any = ...) -> None: ...

    def __new__(cls: Type[_T], iterable: Iterable[_T_co] = ...) -> _T: ...

    def __add__(self, x: Tuple[_T_co, ...]) -> Tuple[_T_co, ...]: ...

    def __add__(self, x: Tuple[Any, ...]) -> Tuple[Any, ...]: ...

    def index(self, __value: Any, __start: int = ..., __stop: int = ...) -> int: ...

        def __class_getitem__(cls, item: Any) -> GenericAlias: ...

    def index(self, __value: _T, __start: int = ..., __stop: int = ...) -> int: ...

    def sort(self: List[SupportsLessThanT], *, key: None = ..., reverse: bool = ...) -> None: ...

    def sort(self, *, key: Callable[[_T], SupportsLessThan], reverse: bool = ...) -> None: ...

    def __setitem__(self, s: slice, o: Iterable[_T]) -> None: ...

    def __init__(self, map: Mapping[_KT, _VT], **kwargs: _VT) -> None: ...

    def __init__(self, iterable: Iterable[Tuple[_KT, _VT]], **kwargs: _VT) -> None: ...

    def __new__(cls: Type[_T1], *args: Any, **kwargs: Any) -> _T1: ...

    def setdefault(self, __key: _KT, __default: _VT = ...) -> _VT: ...

    def update(self, __m: Mapping[_KT, _VT], **kwargs: _VT) -> None: ...

    def update(self, __m: Iterable[Tuple[_KT, _VT]], **kwargs: _VT) -> None: ...

    def fromkeys(cls, __iterable: Iterable[_T]) -> Dict[_T, Any]: ...

    def fromkeys(cls, __iterable: Iterable[_T], __value: _S) -> Dict[_T, _S]: ...

        def __or__(self, __value: Mapping[_KT, _VT]) -> Dict[_KT, _VT]: ...

        def __ior__(self, __value: Mapping[_KT, _VT]) -> Dict[_KT, _VT]: ...

    def __init__(self, iterable: Iterable[_T] = ...) -> None: ...

    def difference_update(self, *s: Iterable[Any]) -> None: ...

    def intersection_update(self, *s: Iterable[Any]) -> None: ...

    def symmetric_difference(self, s: Iterable[_T]) -> Set[_T]: ...

    def symmetric_difference_update(self, s: Iterable[_T]) -> None: ...

    def __or__(self, s: AbstractSet[_S]) -> Set[Union[_T, _S]]: ...

    def __ior__(self, s: AbstractSet[_S]) -> Set[Union[_T, _S]]: ...

    def __sub__(self, s: AbstractSet[Optional[_T]]) -> Set[_T]: ...

    def __isub__(self, s: AbstractSet[Optional[_T]]) -> Set[_T]: ...

    def __xor__(self, s: AbstractSet[_S]) -> Set[Union[_T, _S]]: ...

    def __ixor__(self, s: AbstractSet[_S]) -> Set[Union[_T, _S]]: ...

    def __init__(self, iterable: Iterable[_T_co] = ...) -> None: ...

    def difference(self, *s: Iterable[object]) -> FrozenSet[_T_co]: ...

    def intersection(self, *s: Iterable[object]) -> FrozenSet[_T_co]: ...

    def symmetric_difference(self, s: Iterable[_T_co]) -> FrozenSet[_T_co]: ...

    def union(self, *s: Iterable[_T_co]) -> FrozenSet[_T_co]: ...

    def __and__(self, s: AbstractSet[_T_co]) -> FrozenSet[_T_co]: ...

    def __or__(self, s: AbstractSet[_S]) -> FrozenSet[Union[_T_co, _S]]: ...

    def __sub__(self, s: AbstractSet[_T_co]) -> FrozenSet[_T_co]: ...

    def __xor__(self, s: AbstractSet[_S]) -> FrozenSet[Union[_T_co, _S]]: ...

    def __init__(self, iterable: Iterable[_T], start: int = ...) -> None: ...

    def __init__(self, start: int, stop: int, step: int = ...) -> None: ...

    def getter(self, fget: Callable[[Any], Any]) -> property: ...

    def setter(self, fset: Callable[[Any, Any], None]) -> property: ...

    def deleter(self, fdel: Callable[[Any], None]) -> property: ...

    def __get__(self, obj: Any, type: Optional[type] = ...) -> Any: ...

    __source: Union[str, bytes, CodeType], __globals: Optional[Dict[str, Any]] = ..., __locals: Optional[Mapping[str, Any]] = ...

def filter(__function: None, __iterable: Iterable[Optional[_T]]) -> Iterator[_T]: ...

def filter(__function: Callable[[_T], Any], __iterable: Iterable[_T]) -> Iterator[_T]: ...

def format(__value: object, __format_spec: str = ...) -> str: ...  # TODO unicode

def getattr(__o: Any, name: str, __default: Any = ...) -> Any: ...

def iter(__function: Callable[[], Optional[_T]], __sentinel: None) -> Iterator[_T]: ...

def iter(__function: Callable[[], _T], __sentinel: Any) -> Iterator[_T]: ...

def isinstance(__obj: object, __class_or_tuple: Union[type, Tuple[Union[type, Tuple[Any, ...]], ...]]) -> bool: ...

def issubclass(__cls: type, __class_or_tuple: Union[type, Tuple[Union[type, Tuple[Any, ...]], ...]]) -> bool: ...

def map(__func: Callable[[_T1], _S], __iter1: Iterable[_T1]) -> Iterator[_S]: ...

def map(__func: Callable[[_T1, _T2], _S], __iter1: Iterable[_T1], __iter2: Iterable[_T2]) -> Iterator[_S]: ...

    __func: Callable[[_T1, _T2, _T3], _S], __iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3]

    __arg1: SupportsLessThanT, __arg2: SupportsLessThanT, *_args: SupportsLessThanT, key: None = ...

def max(__arg1: _T, __arg2: _T, *_args: _T, key: Callable[[_T], SupportsLessThanT]) -> _T: ...

def max(__iterable: Iterable[SupportsLessThanT], *, key: None = ...) -> SupportsLessThanT: ...

def max(__iterable: Iterable[_T], *, key: Callable[[_T], SupportsLessThanT]) -> _T: ...

def max(__iterable: Iterable[SupportsLessThanT], *, key: None = ..., default: _T) -> Union[SupportsLessThanT, _T]: ...

def max(__iterable: Iterable[_T1], *, key: Callable[[_T1], SupportsLessThanT], default: _T2) -> Union[_T1, _T2]: ...

def min(__arg1: _T, __arg2: _T, *_args: _T, key: Callable[[_T], SupportsLessThanT]) -> _T: ...

def min(__iterable: Iterable[SupportsLessThanT], *, key: None = ...) -> SupportsLessThanT: ...

def min(__iterable: Iterable[_T], *, key: Callable[[_T], SupportsLessThanT]) -> _T: ...

def min(__iterable: Iterable[SupportsLessThanT], *, key: None = ..., default: _T) -> Union[SupportsLessThanT, _T]: ...

def min(__iterable: Iterable[_T1], *, key: Callable[[_T1], SupportsLessThanT], default: _T2) -> Union[_T1, _T2]: ...

def next(__i: Iterator[_T], default: _VT) -> Union[_T, _VT]: ...

    def pow(base: int, exp: int, mod: None = ...) -> Any: ...  # returns int or float depending on whether exp is non-negative

    def pow(base: float, exp: float, mod: None = ...) -> float: ...

    def pow(base: _SupportsPow2[_E, _T_co], exp: _E) -> _T_co: ...

    def pow(base: _SupportsPow3[_E, _M, _T_co], exp: _E, mod: _M) -> _T_co: ...

    ) -> Any: ...  # returns int or float depending on whether exp is non-negative

    def pow(__base: float, __exp: float, __mod: None = ...) -> float: ...

    def pow(__base: _SupportsPow2[_E, _T_co], __exp: _E) -> _T_co: ...

    def pow(__base: _SupportsPow3[_E, _M, _T_co], __exp: _E, __mod: _M) -> _T_co: ...

def round(number: SupportsRound[_T], ndigits: None) -> int: ...

def setattr(__obj: Any, __name: str, __value: Any) -> None: ...

def sorted(__iterable: Iterable[SupportsLessThanT], *, key: None = ..., reverse: bool = ...) -> List[SupportsLessThanT]: ...

def sorted(__iterable: Iterable[_T], *, key: Callable[[_T], SupportsLessThan], reverse: bool = ...) -> List[_T]: ...

    def sum(__iterable: Iterable[_T], start: _S) -> Union[_T, _S]: ...

    def sum(__iterable: Iterable[_T], __start: _S) -> Union[_T, _S]: ...

def zip(__iter1: Iterable[_T1], __iter2: Iterable[_T2]) -> Iterator[Tuple[_T1, _T2]]: ...

def zip(__iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3]) -> Iterator[Tuple[_T1, _T2, _T3]]: ...

    __iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3], __iter4: Iterable[_T4]

    __iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3], __iter4: Iterable[_T4], __iter5: Iterable[_T5]

    def with_traceback(self: _TBE, tb: Optional[TracebackType]) -> _TBE: ...

    def __init__(self, *args: object, name: Optional[str] = ..., path: Optional[str] = ...) -> None: ...

    def __init__(self, __encoding: str, __object: bytes, __start: int, __end: int, __reason: str) -> None: ...

    def __init__(self, __encoding: str, __object: str, __start: int, __end: int, __reason: str) -> None: ...