massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / coc-python-data / languageServer.0.5.59 / Typeshed / third_party / 2 / six / __init__.pyi
1 # Stubs for six (Python 2.7)\r
2 \r
3 from __future__ import print_function\r
4 \r
5 import types\r
6 from typing import (\r
7     Any, AnyStr, Callable, Dict, Iterable, Mapping, NoReturn, Optional,\r
8     Pattern, Tuple, Type, TypeVar, Union, overload, ValuesView, KeysView, ItemsView\r
9 )\r
10 import typing\r
11 import unittest\r
12 \r
13 # Exports\r
14 from __builtin__ import unichr as unichr\r
15 from StringIO import StringIO as StringIO, StringIO as BytesIO\r
16 from functools import wraps as wraps\r
17 from . import moves\r
18 \r
19 \r
20 _T = TypeVar('_T')\r
21 _K = TypeVar('_K')\r
22 _V = TypeVar('_V')\r
23 \r
24 # TODO make constant, then move this stub to 2and3\r
25 # https://github.com/python/typeshed/issues/17\r
26 PY2 = True\r
27 PY3 = False\r
28 PY34 = False\r
29 \r
30 string_types = (str, unicode)\r
31 integer_types = (int, long)\r
32 class_types = (type, types.ClassType)\r
33 text_type = unicode\r
34 binary_type = str\r
35 \r
36 MAXSIZE = ...  # type: int\r
37 \r
38 # def add_move\r
39 # def remove_move\r
40 \r
41 def advance_iterator(it: typing.Iterator[_T]) -> _T: ...\r
42 next = advance_iterator\r
43 \r
44 def callable(obj: object) -> bool: ...\r
45 \r
46 def get_unbound_function(unbound: types.MethodType) -> types.FunctionType: ...\r
47 def create_bound_method(func: types.FunctionType, obj: object) -> types.MethodType: ...\r
48 def create_unbound_method(func: types.FunctionType, cls: Union[type, types.ClassType]) -> types.MethodType: ...\r
49 \r
50 class Iterator:\r
51     def next(self) -> Any: ...\r
52 \r
53 def get_method_function(meth: types.MethodType) -> types.FunctionType: ...\r
54 def get_method_self(meth: types.MethodType) -> Optional[object]: ...\r
55 def get_function_closure(fun: types.FunctionType) -> Optional[Tuple[types._Cell, ...]]: ...\r
56 def get_function_code(fun: types.FunctionType) -> types.CodeType: ...\r
57 def get_function_defaults(fun: types.FunctionType) -> Optional[Tuple[Any, ...]]: ...\r
58 def get_function_globals(fun: types.FunctionType) -> Dict[str, Any]: ...\r
59 \r
60 def iterkeys(d: Mapping[_K, _V]) -> typing.Iterator[_K]: ...\r
61 def itervalues(d: Mapping[_K, _V]) -> typing.Iterator[_V]: ...\r
62 def iteritems(d: Mapping[_K, _V]) -> typing.Iterator[Tuple[_K, _V]]: ...\r
63 # def iterlists\r
64 \r
65 def viewkeys(d: Mapping[_K, _V]) -> KeysView[_K]: ...\r
66 def viewvalues(d: Mapping[_K, _V]) -> ValuesView[_V]: ...\r
67 def viewitems(d: Mapping[_K, _V]) -> ItemsView[_K, _V]: ...\r
68 \r
69 def b(s: str) -> binary_type: ...\r
70 def u(s: str) -> text_type: ...\r
71 int2byte = chr\r
72 def byte2int(bs: binary_type) -> int: ...\r
73 def indexbytes(buf: binary_type, i: int) -> int: ...\r
74 def iterbytes(buf: binary_type) -> typing.Iterator[int]: ...\r
75 \r
76 def assertCountEqual(self: unittest.TestCase, first: Iterable[_T], second: Iterable[_T], msg: str = ...) -> None: ...\r
77 @overload\r
78 def assertRaisesRegex(self: unittest.TestCase, msg: str = ...) -> Any: ...\r
79 @overload\r
80 def assertRaisesRegex(self: unittest.TestCase, callable_obj: Callable[..., Any], *args: Any, **kwargs: Any) -> Any: ...\r
81 def assertRegex(self: unittest.TestCase, text: AnyStr, expected_regex: Union[AnyStr, Pattern[AnyStr]], msg: str = ...) -> None: ...\r
82 \r
83 def reraise(tp: Optional[Type[BaseException]], value: Optional[BaseException], tb: Optional[types.TracebackType] = ...) -> NoReturn: ...\r
84 def exec_(_code_: Union[unicode, types.CodeType], _globs_: Dict[str, Any] = ..., _locs_: Dict[str, Any] = ...): ...\r
85 def raise_from(value: BaseException, from_value: Optional[BaseException]) -> NoReturn: ...\r
86 \r
87 print_ = print\r
88 \r
89 def with_metaclass(meta: type, *bases: type) -> type: ...\r
90 def add_metaclass(metaclass: type) -> Callable[[_T], _T]: ...\r
91 def python_2_unicode_compatible(klass: _T) -> _T: ...\r