massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-pyright / node_modules / pyright / dist / typeshed-fallback / stubs / six / six / __init__.pyi
1 from __future__ import print_function
2
3 import types
4 import unittest
5 from builtins import next as next
6 from collections.abc import Callable, ItemsView, Iterable, Iterator as _Iterator, KeysView, Mapping, ValuesView
7 from functools import wraps as wraps
8 from io import BytesIO as BytesIO, StringIO as StringIO
9 from typing import Any, AnyStr, NoReturn, Pattern, Tuple, Type, TypeVar, overload
10 from typing_extensions import Literal
11
12 from . import moves as moves
13
14 _T = TypeVar("_T")
15 _K = TypeVar("_K")
16 _V = TypeVar("_V")
17
18 __author__: str
19 __version__: str
20
21 PY2: Literal[False]
22 PY3: Literal[True]
23 PY34: Literal[True]
24
25 string_types: tuple[Type[str]]
26 integer_types: tuple[Type[int]]
27 class_types: tuple[Type[Type[Any]]]
28 text_type = str
29 binary_type = bytes
30
31 MAXSIZE: int
32
33 def callable(obj: object) -> bool: ...
34 def get_unbound_function(unbound: types.FunctionType) -> types.FunctionType: ...
35 def create_bound_method(func: types.FunctionType, obj: object) -> types.MethodType: ...
36 def create_unbound_method(func: types.FunctionType, cls: type) -> types.FunctionType: ...
37
38 Iterator = object
39
40 def get_method_function(meth: types.MethodType) -> types.FunctionType: ...
41 def get_method_self(meth: types.MethodType) -> object | None: ...
42 def get_function_closure(fun: types.FunctionType) -> Tuple[types._Cell, ...] | None: ...
43 def get_function_code(fun: types.FunctionType) -> types.CodeType: ...
44 def get_function_defaults(fun: types.FunctionType) -> Tuple[Any, ...] | None: ...
45 def get_function_globals(fun: types.FunctionType) -> dict[str, Any]: ...
46 def iterkeys(d: Mapping[_K, Any]) -> _Iterator[_K]: ...
47 def itervalues(d: Mapping[Any, _V]) -> _Iterator[_V]: ...
48 def iteritems(d: Mapping[_K, _V]) -> _Iterator[tuple[_K, _V]]: ...
49
50 # def iterlists
51
52 def viewkeys(d: Mapping[_K, Any]) -> KeysView[_K]: ...
53 def viewvalues(d: Mapping[Any, _V]) -> ValuesView[_V]: ...
54 def viewitems(d: Mapping[_K, _V]) -> ItemsView[_K, _V]: ...
55 def b(s: str) -> bytes: ...
56 def u(s: str) -> str: ...
57
58 unichr = chr
59
60 def int2byte(i: int) -> bytes: ...
61 def byte2int(bs: bytes) -> int: ...
62 def indexbytes(buf: bytes, i: int) -> int: ...
63 def iterbytes(buf: bytes) -> _Iterator[int]: ...
64 def assertCountEqual(self: unittest.TestCase, first: Iterable[_T], second: Iterable[_T], msg: str | None = ...) -> None: ...
65 @overload
66 def assertRaisesRegex(self: unittest.TestCase, msg: str | None = ...) -> Any: ...
67 @overload
68 def assertRaisesRegex(self: unittest.TestCase, callable_obj: Callable[..., Any], *args: Any, **kwargs: Any) -> Any: ...
69 def assertRegex(
70     self: unittest.TestCase, text: AnyStr, expected_regex: AnyStr | Pattern[AnyStr], msg: str | None = ...
71 ) -> None: ...
72
73 exec_ = exec
74
75 def reraise(tp: Type[BaseException] | None, value: BaseException | None, tb: types.TracebackType | None = ...) -> NoReturn: ...
76 def raise_from(value: BaseException | Type[BaseException], from_value: BaseException | None) -> NoReturn: ...
77
78 print_ = print
79
80 def with_metaclass(meta: type, *bases: type) -> type: ...
81 def add_metaclass(metaclass: type) -> Callable[[_T], _T]: ...
82 def ensure_binary(s: bytes | str, encoding: str = ..., errors: str = ...) -> bytes: ...
83 def ensure_str(s: bytes | str, encoding: str = ..., errors: str = ...) -> str: ...
84 def ensure_text(s: bytes | str, encoding: str = ..., errors: str = ...) -> str: ...
85 def python_2_unicode_compatible(klass: _T) -> _T: ...
86
87 class _LazyDescr:
88     name: str
89     def __init__(self, name: str) -> None: ...
90     def __get__(self, obj: object | None, type: Type[Any] | None = ...) -> Any: ...
91
92 class MovedModule(_LazyDescr):
93     mod: str
94     def __init__(self, name: str, old: str, new: str | None = ...) -> None: ...
95     def __getattr__(self, attr: str) -> Any: ...
96
97 class MovedAttribute(_LazyDescr):
98     mod: str
99     attr: str
100     def __init__(self, name: str, old_mod: str, new_mod: str, old_attr: str | None = ..., new_attr: str | None = ...) -> None: ...
101
102 def add_move(move: MovedModule | MovedAttribute) -> None: ...
103 def remove_move(name: str) -> None: ...