"""Stub file for the '_collections' module."""

from typing import Any, Generic, Iterator, TypeVar, Optional, Union

class defaultdict(dict):
    default_factory = ...  # type: None
    def __init__(self, default: Any = ..., init: Any = ...) -> None: ...
    def __missing__(self, key) -> Any:
        raise KeyError()
    def __copy__(self) -> "defaultdict": ...
    def copy(self) -> "defaultdict": ...

_T = TypeVar('_T')
_T2 = TypeVar('_T2')

class deque(Generic[_T]):
    maxlen = ...  # type: Optional[int]
    def __init__(self, iterable: Iterator[_T] = ..., maxlen: int = ...) -> None: ...
    def append(self, x: _T) -> None: ...
    def appendleft(self, x: _T) -> None: ...
    def clear(self) -> None: ...
    def count(self, x: Any) -> int: ...
    def extend(self, iterable: Iterator[_T]) -> None: ...
    def extendleft(self, iterable: Iterator[_T]) -> None: ...
    def pop(self) -> _T:
        raise IndexError()
    def popleft(self) -> _T:
        raise IndexError()
    def remove(self, value: _T) -> None:
        raise IndexError()
    def reverse(self) -> None: ...
    def rotate(self, n: int = ...) -> None: ...
    def __contains__(self, o: Any) -> bool: ...
    def __copy__(self) -> "deque[_T]": ...
    def __getitem__(self, i: int) -> _T:
        raise IndexError()
    def __iadd__(self, other: "deque[_T2]") -> "deque[Union[_T, _T2]]": ...
    def __iter__(self) -> Iterator[_T]: ...
    def __len__(self) -> int: ...
    def __reversed__(self) -> Iterator[_T]: ...
    def __setitem__(self, i: int, x: _T) -> None: ...
