massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / coc-python-data / languageServer.0.5.59 / Typeshed / stdlib / 2 / typing.pyi
diff --git a/.config/coc/extensions/coc-python-data/languageServer.0.5.59/Typeshed/stdlib/2/typing.pyi b/.config/coc/extensions/coc-python-data/languageServer.0.5.59/Typeshed/stdlib/2/typing.pyi
new file mode 100644 (file)
index 0000000..c88fe12
--- /dev/null
@@ -0,0 +1,436 @@
+# Stubs for typing (Python 2.7)\r
+\r
+from abc import abstractmethod, ABCMeta\r
+from types import CodeType, FrameType, TracebackType\r
+import collections  # Needed by aliases like DefaultDict, see mypy issue 2986\r
+\r
+# Definitions of special type checking related constructs.  Their definitions\r
+# are not used, so their value does not matter.\r
+\r
+overload = object()\r
+Any = object()\r
+TypeVar = object()\r
+_promote = object()\r
+no_type_check = object()\r
+\r
+class _SpecialForm(object):\r
+    def __getitem__(self, typeargs: Any) -> object: ...\r
+\r
+Tuple: _SpecialForm = ...\r
+Generic: _SpecialForm = ...\r
+Protocol: _SpecialForm = ...\r
+Callable: _SpecialForm = ...\r
+Type: _SpecialForm = ...\r
+ClassVar: _SpecialForm = ...\r
+\r
+class GenericMeta(type): ...\r
+\r
+# Return type that indicates a function does not return.\r
+# This type is equivalent to the None type, but the no-op Union is necessary to\r
+# distinguish the None type from the None value.\r
+NoReturn = Union[None]\r
+\r
+# Type aliases and type constructors\r
+\r
+class TypeAlias:\r
+    # Class for defining generic aliases for library types.\r
+    def __init__(self, target_type: type) -> None: ...\r
+    def __getitem__(self, typeargs: Any) -> Any: ...\r
+\r
+Union = TypeAlias(object)\r
+Optional = TypeAlias(object)\r
+List = TypeAlias(object)\r
+Dict = TypeAlias(object)\r
+DefaultDict = TypeAlias(object)\r
+Set = TypeAlias(object)\r
+FrozenSet = TypeAlias(object)\r
+Counter = TypeAlias(object)\r
+Deque = TypeAlias(object)\r
+\r
+# Predefined type variables.\r
+AnyStr = TypeVar('AnyStr', str, unicode)\r
+\r
+# Abstract base classes.\r
+\r
+# These type variables are used by the container types.\r
+_T = TypeVar('_T')\r
+_S = TypeVar('_S')\r
+_KT = TypeVar('_KT')  # Key type.\r
+_VT = TypeVar('_VT')  # Value type.\r
+_T_co = TypeVar('_T_co', covariant=True)  # Any type covariant containers.\r
+_V_co = TypeVar('_V_co', covariant=True)  # Any type covariant containers.\r
+_KT_co = TypeVar('_KT_co', covariant=True)  # Key type covariant containers.\r
+_VT_co = TypeVar('_VT_co', covariant=True)  # Value type covariant containers.\r
+_T_contra = TypeVar('_T_contra', contravariant=True)  # Ditto contravariant.\r
+_TC = TypeVar('_TC', bound=Type[object])\r
+\r
+def runtime(cls: _TC) -> _TC: ...\r
+\r
+@runtime\r
+class SupportsInt(Protocol, metaclass=ABCMeta):\r
+    @abstractmethod\r
+    def __int__(self) -> int: ...\r
+\r
+@runtime\r
+class SupportsFloat(Protocol, metaclass=ABCMeta):\r
+    @abstractmethod\r
+    def __float__(self) -> float: ...\r
+\r
+@runtime\r
+class SupportsComplex(Protocol, metaclass=ABCMeta):\r
+    @abstractmethod\r
+    def __complex__(self) -> complex: ...\r
+\r
+@runtime\r
+class SupportsAbs(Protocol[_T_co]):\r
+    @abstractmethod\r
+    def __abs__(self) -> _T_co: ...\r
+\r
+@runtime\r
+class SupportsRound(Protocol[_T_co]):\r
+    @abstractmethod\r
+    def __round__(self, ndigits: int = ...) -> _T_co: ...\r
+\r
+@runtime\r
+class Reversible(Protocol[_T_co]):\r
+    @abstractmethod\r
+    def __reversed__(self) -> Iterator[_T_co]: ...\r
+\r
+@runtime\r
+class Sized(Protocol, metaclass=ABCMeta):\r
+    @abstractmethod\r
+    def __len__(self) -> int: ...\r
+\r
+@runtime\r
+class Hashable(Protocol, metaclass=ABCMeta):\r
+    # TODO: This is special, in that a subclass of a hashable class may not be hashable\r
+    #   (for example, list vs. object). It's not obvious how to represent this. This class\r
+    #   is currently mostly useless for static checking.\r
+    @abstractmethod\r
+    def __hash__(self) -> int: ...\r
+\r
+@runtime\r
+class Iterable(Protocol[_T_co]):\r
+    @abstractmethod\r
+    def __iter__(self) -> Iterator[_T_co]: ...\r
+\r
+@runtime\r
+class Iterator(Iterable[_T_co], Protocol[_T_co]):\r
+    @abstractmethod\r
+    def next(self) -> _T_co: ...\r
+    def __iter__(self) -> Iterator[_T_co]: ...\r
+\r
+class Generator(Iterator[_T_co], Generic[_T_co, _T_contra, _V_co]):\r
+    @abstractmethod\r
+    def next(self) -> _T_co: ...\r
+\r
+    @abstractmethod\r
+    def send(self, value: _T_contra) -> _T_co: ...\r
+\r
+    @abstractmethod\r
+    def throw(self, typ: Type[BaseException], val: Optional[BaseException] = ...,\r
+              tb: TracebackType = ...) -> _T_co: ...\r
+    @abstractmethod\r
+    def close(self) -> None: ...\r
+    @property\r
+    def gi_code(self) -> CodeType: ...\r
+    @property\r
+    def gi_frame(self) -> FrameType: ...\r
+    @property\r
+    def gi_running(self) -> bool: ...\r
+\r
+@runtime\r
+class Container(Protocol[_T_co]):\r
+    @abstractmethod\r
+    def __contains__(self, x: object) -> bool: ...\r
+\r
+class Sequence(Iterable[_T_co], Container[_T_co], Sized, Reversible[_T_co], Generic[_T_co]):\r
+    @overload\r
+    @abstractmethod\r
+    def __getitem__(self, i: int) -> _T_co: ...\r
+    @overload\r
+    @abstractmethod\r
+    def __getitem__(self, s: slice) -> Sequence[_T_co]: ...\r
+    # Mixin methods\r
+    def index(self, x: Any) -> int: ...\r
+    def count(self, x: Any) -> int: ...\r
+    def __contains__(self, x: object) -> bool: ...\r
+    def __iter__(self) -> Iterator[_T_co]: ...\r
+    def __reversed__(self) -> Iterator[_T_co]: ...\r
+\r
+class MutableSequence(Sequence[_T], Generic[_T]):\r
+    @abstractmethod\r
+    def insert(self, index: int, object: _T) -> None: ...\r
+    @overload\r
+    @abstractmethod\r
+    def __setitem__(self, i: int, o: _T) -> None: ...\r
+    @overload\r
+    @abstractmethod\r
+    def __setitem__(self, s: slice, o: Iterable[_T]) -> None: ...\r
+    @overload\r
+    @abstractmethod\r
+    def __delitem__(self, i: int) -> None: ...\r
+    @overload\r
+    @abstractmethod\r
+    def __delitem__(self, i: slice) -> None: ...\r
+    # Mixin methods\r
+    def append(self, object: _T) -> None: ...\r
+    def extend(self, iterable: Iterable[_T]) -> None: ...\r
+    def reverse(self) -> None: ...\r
+    def pop(self, index: int = ...) -> _T: ...\r
+    def remove(self, object: _T) -> None: ...\r
+    def __iadd__(self, x: Iterable[_T]) -> MutableSequence[_T]: ...\r
+\r
+class AbstractSet(Sized, Iterable[_T_co], Container[_T_co], Generic[_T_co]):\r
+    @abstractmethod\r
+    def __contains__(self, x: object) -> bool: ...\r
+    # Mixin methods\r
+    def __le__(self, s: AbstractSet[Any]) -> bool: ...\r
+    def __lt__(self, s: AbstractSet[Any]) -> bool: ...\r
+    def __gt__(self, s: AbstractSet[Any]) -> bool: ...\r
+    def __ge__(self, s: AbstractSet[Any]) -> bool: ...\r
+    def __and__(self, s: AbstractSet[Any]) -> AbstractSet[_T_co]: ...\r
+    def __or__(self, s: AbstractSet[_T]) -> AbstractSet[Union[_T_co, _T]]: ...\r
+    def __sub__(self, s: AbstractSet[Any]) -> AbstractSet[_T_co]: ...\r
+    def __xor__(self, s: AbstractSet[_T]) -> AbstractSet[Union[_T_co, _T]]: ...\r
+    # TODO: argument can be any container?\r
+    def isdisjoint(self, s: AbstractSet[Any]) -> bool: ...\r
+\r
+class MutableSet(AbstractSet[_T], Generic[_T]):\r
+    @abstractmethod\r
+    def add(self, x: _T) -> None: ...\r
+    @abstractmethod\r
+    def discard(self, x: _T) -> None: ...\r
+    # Mixin methods\r
+    def clear(self) -> None: ...\r
+    def pop(self) -> _T: ...\r
+    def remove(self, element: _T) -> None: ...\r
+    def __ior__(self, s: AbstractSet[_S]) -> MutableSet[Union[_T, _S]]: ...\r
+    def __iand__(self, s: AbstractSet[Any]) -> MutableSet[_T]: ...\r
+    def __ixor__(self, s: AbstractSet[_S]) -> MutableSet[Union[_T, _S]]: ...\r
+    def __isub__(self, s: AbstractSet[Any]) -> MutableSet[_T]: ...\r
+\r
+class MappingView(Sized):\r
+    def __len__(self) -> int: ...\r
+\r
+class ItemsView(AbstractSet[Tuple[_KT_co, _VT_co]], MappingView, Generic[_KT_co, _VT_co]):\r
+    def __contains__(self, o: object) -> bool: ...\r
+    def __iter__(self) -> Iterator[Tuple[_KT_co, _VT_co]]: ...\r
+\r
+class KeysView(AbstractSet[_KT_co], MappingView, Generic[_KT_co]):\r
+    def __contains__(self, o: object) -> bool: ...\r
+    def __iter__(self) -> Iterator[_KT_co]: ...\r
+\r
+class ValuesView(MappingView, Iterable[_VT_co], Generic[_VT_co]):\r
+    def __contains__(self, o: object) -> bool: ...\r
+    def __iter__(self) -> Iterator[_VT_co]: ...\r
+\r
+@runtime\r
+class ContextManager(Protocol[_T_co]):\r
+    def __enter__(self) -> _T_co: ...\r
+    def __exit__(self, exc_type: Optional[Type[BaseException]],\r
+                 exc_value: Optional[BaseException],\r
+                 traceback: Optional[TracebackType]) -> Optional[bool]: ...\r
+\r
+class Mapping(Iterable[_KT], Container[_KT], Sized, Generic[_KT, _VT_co]):\r
+    # TODO: We wish the key type could also be covariant, but that doesn't work,\r
+    # see discussion in https: //github.com/python/typing/pull/273.\r
+    @abstractmethod\r
+    def __getitem__(self, k: _KT) -> _VT_co:\r
+        ...\r
+    # Mixin methods\r
+    @overload\r
+    def get(self, k: _KT) -> Optional[_VT_co]: ...\r
+    @overload\r
+    def get(self, k: _KT, default: Union[_VT_co, _T]) -> Union[_VT_co, _T]: ...\r
+    def keys(self) -> list[_KT]: ...\r
+    def values(self) -> list[_VT_co]: ...\r
+    def items(self) -> list[Tuple[_KT, _VT_co]]: ...\r
+    def iterkeys(self) -> Iterator[_KT]: ...\r
+    def itervalues(self) -> Iterator[_VT_co]: ...\r
+    def iteritems(self) -> Iterator[Tuple[_KT, _VT_co]]: ...\r
+    def __contains__(self, o: object) -> bool: ...\r
+\r
+class MutableMapping(Mapping[_KT, _VT], Generic[_KT, _VT]):\r
+    @abstractmethod\r
+    def __setitem__(self, k: _KT, v: _VT) -> None: ...\r
+    @abstractmethod\r
+    def __delitem__(self, v: _KT) -> None: ...\r
+\r
+    def clear(self) -> None: ...\r
+    @overload\r
+    def pop(self, k: _KT) -> _VT: ...\r
+    @overload\r
+    def pop(self, k: _KT, default: Union[_VT, _T] = ...) -> Union[_VT, _T]: ...\r
+    def popitem(self) -> Tuple[_KT, _VT]: ...\r
+    def setdefault(self, k: _KT, default: _VT = ...) -> _VT: ...\r
+    @overload\r
+    def update(self, __m: Mapping[_KT, _VT], **kwargs: _VT) -> None: ...\r
+    @overload\r
+    def update(self, __m: Iterable[Tuple[_KT, _VT]], **kwargs: _VT) -> None: ...\r
+    @overload\r
+    def update(self, **kwargs: _VT) -> None: ...\r
+\r
+Text = unicode\r
+\r
+TYPE_CHECKING = True\r
+\r
+class IO(Iterator[AnyStr], Generic[AnyStr]):\r
+    # TODO detach\r
+    # TODO use abstract properties\r
+    @property\r
+    def mode(self) -> str: ...\r
+    @property\r
+    def name(self) -> str: ...\r
+    @abstractmethod\r
+    def close(self) -> None: ...\r
+    @property\r
+    def closed(self) -> bool: ...\r
+    @abstractmethod\r
+    def fileno(self) -> int: ...\r
+    @abstractmethod\r
+    def flush(self) -> None: ...\r
+    @abstractmethod\r
+    def isatty(self) -> bool: ...\r
+    # TODO what if n is None?\r
+    @abstractmethod\r
+    def read(self, n: int = ...) -> AnyStr: ...\r
+    @abstractmethod\r
+    def readable(self) -> bool: ...\r
+    @abstractmethod\r
+    def readline(self, limit: int = ...) -> AnyStr: ...\r
+    @abstractmethod\r
+    def readlines(self, hint: int = ...) -> list[AnyStr]: ...\r
+    @abstractmethod\r
+    def seek(self, offset: int, whence: int = ...) -> int: ...\r
+    @abstractmethod\r
+    def seekable(self) -> bool: ...\r
+    @abstractmethod\r
+    def tell(self) -> int: ...\r
+    @abstractmethod\r
+    def truncate(self, size: Optional[int] = ...) -> int: ...\r
+    @abstractmethod\r
+    def writable(self) -> bool: ...\r
+    # TODO buffer objects\r
+    @abstractmethod\r
+    def write(self, s: AnyStr) -> int: ...\r
+    @abstractmethod\r
+    def writelines(self, lines: Iterable[AnyStr]) -> None: ...\r
+\r
+    @abstractmethod\r
+    def next(self) -> AnyStr: ...\r
+    @abstractmethod\r
+    def __iter__(self) -> Iterator[AnyStr]: ...\r
+    @abstractmethod\r
+    def __enter__(self) -> IO[AnyStr]: ...\r
+    @abstractmethod\r
+    def __exit__(self, t: Optional[Type[BaseException]], value: Optional[BaseException],\r
+                 traceback: Optional[TracebackType]) -> bool: ...\r
+\r
+class BinaryIO(IO[str]):\r
+    # TODO readinto\r
+    # TODO read1?\r
+    # TODO peek?\r
+    @abstractmethod\r
+    def __enter__(self) -> BinaryIO: ...\r
+\r
+class TextIO(IO[unicode]):\r
+    # TODO use abstractproperty\r
+    @property\r
+    def buffer(self) -> BinaryIO: ...\r
+    @property\r
+    def encoding(self) -> str: ...\r
+    @property\r
+    def errors(self) -> Optional[str]: ...\r
+    @property\r
+    def line_buffering(self) -> bool: ...\r
+    @property\r
+    def newlines(self) -> Any: ...  # None, str or tuple\r
+    @abstractmethod\r
+    def __enter__(self) -> TextIO: ...\r
+\r
+class ByteString(Sequence[int], metaclass=ABCMeta): ...\r
+\r
+class Match(Generic[AnyStr]):\r
+    pos = 0\r
+    endpos = 0\r
+    lastindex = 0\r
+    lastgroup = ...  # type: AnyStr\r
+    string = ...  # type: AnyStr\r
+\r
+    # The regular expression object whose match() or search() method produced\r
+    # this match instance.\r
+    re = ...  # type: 'Pattern[AnyStr]'\r
+\r
+    def expand(self, template: AnyStr) -> AnyStr: ...\r
+\r
+    @overload\r
+    def group(self, group1: int = ...) -> AnyStr: ...\r
+    @overload\r
+    def group(self, group1: str) -> AnyStr: ...\r
+    @overload\r
+    def group(self, group1: int, group2: int,\r
+              *groups: int) -> Sequence[AnyStr]: ...\r
+    @overload\r
+    def group(self, group1: str, group2: str,\r
+              *groups: str) -> Sequence[AnyStr]: ...\r
+\r
+    def groups(self, default: AnyStr = ...) -> Sequence[AnyStr]: ...\r
+    def groupdict(self, default: AnyStr = ...) -> dict[str, AnyStr]: ...\r
+    def start(self, group: Union[int, str] = ...) -> int: ...\r
+    def end(self, group: Union[int, str] = ...) -> int: ...\r
+    def span(self, group: Union[int, str] = ...) -> Tuple[int, int]: ...\r
+\r
+class Pattern(Generic[AnyStr]):\r
+    flags = 0\r
+    groupindex = 0\r
+    groups = 0\r
+    pattern = ...  # type: AnyStr\r
+\r
+    def search(self, string: AnyStr, pos: int = ...,\r
+               endpos: int = ...) -> Optional[Match[AnyStr]]: ...\r
+    def match(self, string: AnyStr, pos: int = ...,\r
+              endpos: int = ...) -> Optional[Match[AnyStr]]: ...\r
+    def split(self, string: AnyStr, maxsplit: int = ...) -> list[AnyStr]: ...\r
+    def findall(self, string: AnyStr, pos: int = ...,\r
+                endpos: int = ...) -> list[Any]: ...\r
+    def finditer(self, string: AnyStr, pos: int = ...,\r
+                 endpos: int = ...) -> Iterator[Match[AnyStr]]: ...\r
+\r
+    @overload\r
+    def sub(self, repl: AnyStr, string: AnyStr,\r
+            count: int = ...) -> AnyStr: ...\r
+    @overload\r
+    def sub(self, repl: Callable[[Match[AnyStr]], AnyStr], string: AnyStr,\r
+            count: int = ...) -> AnyStr: ...\r
+\r
+    @overload\r
+    def subn(self, repl: AnyStr, string: AnyStr,\r
+             count: int = ...) -> Tuple[AnyStr, int]: ...\r
+    @overload\r
+    def subn(self, repl: Callable[[Match[AnyStr]], AnyStr], string: AnyStr,\r
+             count: int = ...) -> Tuple[AnyStr, int]: ...\r
+\r
+# Functions\r
+\r
+def get_type_hints(obj: Callable, globalns: Optional[dict[Text, Any]] = ...,\r
+                   localns: Optional[dict[Text, Any]] = ...) -> None: ...\r
+\r
+def cast(tp: Type[_T], obj: Any) -> _T: ...\r
+\r
+# Type constructors\r
+\r
+# NamedTuple is special-cased in the type checker\r
+class NamedTuple(tuple):\r
+    _fields = ...  # type: Tuple[str, ...]\r
+\r
+    def __init__(self, typename: str, fields: Iterable[Tuple[str, Any]] = ..., *,\r
+                 verbose: bool = ..., rename: bool = ..., **kwargs: Any) -> None: ...\r
+\r
+    @classmethod\r
+    def _make(cls: Type[_T], iterable: Iterable[Any]) -> _T: ...\r
+\r
+    def _asdict(self) -> dict: ...\r
+    def _replace(self: _T, **kwargs: Any) -> _T: ...\r
+\r
+def NewType(name: str, tp: Type[_T]) -> Type[_T]: ...\r