# Definitions of special type checking related constructs.  Their definitions
# are not used, so their value does not matter.

# Protocol is only present in 3.8 and later, but mypy needs it unconditionally

# Return type that indicates a function does not return.
# This type is equivalent to the None type, but the no-op Union is necessary to
# distinguish the None type from the None value.

    # Class for defining generic aliases for library types.
    
    # TODO: This is special, in that a subclass of a hashable class may not be hashable
    #   (for example, list vs. object). It's not obvious how to represent this. This class
    #   is currently mostly useless for static checking.
    
# NOTE: This type does not exist in typing.py or PEP 484.
# The parameters correspond to Generator, but the 4th is the original type.

    # TODO: We wish the key type could also be covariant, but that doesn't work,
    # see discussion in https: //github.com/python/typing/pull/273.
    
    # 'update' used to take a Union, but using overloading is better.
    # The second overloaded type here is a bit too general, because
    # Mapping[Tuple[_KT, _VT], W] is a subclass of Iterable[Tuple[_KT, _VT]],
    # but will always have the behavior of the first overloaded type
    # at runtime, leading to keys of a mix of types _KT and Tuple[_KT, _VT].
    # We don't currently have any way of forcing all Mappings to use
    # the first overload, but by using overloading rather than a Union,
    # mypy will commit to using the first overload when the argument is
    # known to be a Mapping with unknown type parameters, which is closer
    # to the behavior we want. See mypy issue  #1430.
    
    # The regular expression object whose match() or search() method produced
    # this match instance.
    
    # TODO: The return for a group may be None, except if __group is 0 or not given.
    
# Type constructors

# NamedTuple is special-cased in the type checker

# Internal mypy fallback type for all typed dicts (does not exist at runtime)

    # Using NoReturn so that only calls using mypy plugin hook that specialize the signature
    # can go through.
    
    # Mypy plugin hook for 'pop' expects that 'default' has a type variable type.
    
import collections  # Needed by aliases like DefaultDict, see mypy issue 2986

from types import BuiltinFunctionType, CodeType, FrameType, FunctionType, MethodType, ModuleType, TracebackType

    from types import MethodDescriptorType, MethodWrapperType, WrapperDescriptorType

_T_co = TypeVar("_T_co", covariant=True)  # Any type covariant containers.

_V_co = TypeVar("_V_co", covariant=True)  # Any type covariant containers.

_KT_co = TypeVar("_KT_co", covariant=True)  # Key type covariant containers.

_VT_co = TypeVar("_VT_co", covariant=True)  # Value type covariant containers.

_T_contra = TypeVar("_T_contra", contravariant=True)  # Ditto contravariant.

class Generator(Iterator[_T_co], Generic[_T_co, _T_contra, _V_co]):

        self, __typ: Type[BaseException], __val: Union[BaseException, object] = ..., __tb: Optional[TracebackType] = ...

    def throw(self, __typ: BaseException, __val: None = ..., __tb: Optional[TracebackType] = ...) -> _T_co: ...

    def __iter__(self) -> Generator[_T_co, _T_contra, _V_co]: ...

    def gi_yieldfrom(self) -> Optional[Generator[Any, Any, Any]]: ...

class Coroutine(Awaitable[_V_co], Generic[_T_co, _T_contra, _V_co]):

    Awaitable[_V_co], Generator[_T_co, _T_contra, _V_co], Generic[_T_co, _T_contra, _V_co, _S], metaclass=ABCMeta

class AsyncGenerator(AsyncIterator[_T_co], Generic[_T_co, _T_contra]):

    def asend(self, __value: _T_contra) -> Awaitable[_T_co]: ...

    def athrow(self, __typ: BaseException, __val: None = ..., __tb: Optional[TracebackType] = ...) -> Awaitable[_T_co]: ...

    def __aiter__(self) -> AsyncGenerator[_T_co, _T_contra]: ...

class Collection(Iterable[_T_co], Container[_T_co], Protocol[_T_co]):

class Sequence(_Collection[_T_co], Reversible[_T_co], Generic[_T_co]):

    def index(self, value: Any, start: int = ..., stop: int = ...) -> int: ...

    def __getitem__(self, s: slice) -> MutableSequence[_T]: ...

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

    def __iadd__(self, x: Iterable[_T]) -> MutableSequence[_T]: ...

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

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

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

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

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

    def __iand__(self, s: AbstractSet[Any]) -> MutableSet[_T]: ...

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

    def __isub__(self, s: AbstractSet[Any]) -> MutableSet[_T]: ...

    def __init__(self, mapping: Mapping[_KT_co, _VT_co]) -> None: ...  # undocumented

class ItemsView(MappingView, AbstractSet[Tuple[_KT_co, _VT_co]], Generic[_KT_co, _VT_co]):

    def __and__(self, o: Iterable[Any]) -> Set[Tuple[_KT_co, _VT_co]]: ...

        def __reversed__(self) -> Iterator[Tuple[_KT_co, _VT_co]]: ...

    def __or__(self, o: Iterable[_T]) -> Set[Union[Tuple[_KT_co, _VT_co], _T]]: ...

    def __ror__(self, o: Iterable[_T]) -> Set[Union[Tuple[_KT_co, _VT_co], _T]]: ...

    def __sub__(self, o: Iterable[Any]) -> Set[Tuple[_KT_co, _VT_co]]: ...

    def __xor__(self, o: Iterable[_T]) -> Set[Union[Tuple[_KT_co, _VT_co], _T]]: ...

    def __rxor__(self, o: Iterable[_T]) -> Set[Union[Tuple[_KT_co, _VT_co], _T]]: ...

class KeysView(MappingView, AbstractSet[_KT_co], Generic[_KT_co]):

    def __or__(self, o: Iterable[_T]) -> Set[Union[_KT_co, _T]]: ...

    def __ror__(self, o: Iterable[_T]) -> Set[Union[_KT_co, _T]]: ...

    def __xor__(self, o: Iterable[_T]) -> Set[Union[_KT_co, _T]]: ...

    def __rxor__(self, o: Iterable[_T]) -> Set[Union[_KT_co, _T]]: ...

class ValuesView(MappingView, Iterable[_VT_co], Generic[_VT_co]):

        self, exc_type: Optional[Type[BaseException]], exc_value: Optional[BaseException], traceback: Optional[TracebackType]

    def get(self, key: _KT, default: Union[_VT_co, _T]) -> Union[_VT_co, _T]: ...

    def pop(self, key: _KT, default: Union[_VT, _T] = ...) -> Union[_VT, _T]: ...

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

        self, t: Optional[Type[BaseException]], value: Optional[BaseException], traceback: Optional[TracebackType]

    def line_buffering(self) -> int: ...  # int on PyPy, bool on CPython

    def group(self, __group: Union[str, int] = ...) -> AnyStr: ...

    def group(self, __group1: Union[str, int], __group2: Union[str, int], *groups: Union[str, int]) -> Tuple[AnyStr, ...]: ...

    def groups(self, default: AnyStr = ...) -> Sequence[AnyStr]: ...

    def groupdict(self, default: AnyStr = ...) -> dict[str, AnyStr]: ...

    def start(self, __group: Union[int, str] = ...) -> int: ...

    def span(self, __group: Union[int, str] = ...) -> Tuple[int, int]: ...

    def regs(self) -> Tuple[Tuple[int, int], ...]: ...  # undocumented

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

    def search(self, string: AnyStr, pos: int = ..., endpos: int = ...) -> Optional[Match[AnyStr]]: ...

    def match(self, string: AnyStr, pos: int = ..., endpos: int = ...) -> Optional[Match[AnyStr]]: ...

    def fullmatch(self, string: AnyStr, pos: int = ..., endpos: int = ...) -> Optional[Match[AnyStr]]: ...

    def split(self, string: AnyStr, maxsplit: int = ...) -> list[AnyStr]: ...

    def findall(self, string: AnyStr, pos: int = ..., endpos: int = ...) -> list[Any]: ...

    def finditer(self, string: AnyStr, pos: int = ..., endpos: int = ...) -> Iterator[Match[AnyStr]]: ...

    def sub(self, repl: AnyStr, string: AnyStr, count: int = ...) -> AnyStr: ...

    def sub(self, repl: Callable[[Match[AnyStr]], AnyStr], string: AnyStr, count: int = ...) -> AnyStr: ...

    def subn(self, repl: AnyStr, string: AnyStr, count: int = ...) -> Tuple[AnyStr, int]: ...

    def subn(self, repl: Callable[[Match[AnyStr]], AnyStr], string: AnyStr, count: int = ...) -> Tuple[AnyStr, int]: ...

    def __init__(self, typename: str, fields: Iterable[Tuple[str, Any]] = ..., **kwargs: Any) -> None: ...

    def _make(cls: Type[_T], iterable: Iterable[Any]) -> _T: ...

        def _asdict(self) -> collections.OrderedDict[str, Any]: ...

    def setdefault(self, k: NoReturn, default: object) -> object: ...

    def pop(self, k: NoReturn, default: _T = ...) -> object: ...

        def __init__(self, arg: str, is_argument: bool = ...) -> None: ...

        def _evaluate(self, globalns: Optional[Dict[str, Any]], localns: Optional[Dict[str, Any]]) -> Optional[Any]: ...