1 from __future__ import print_function
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
12 from . import moves as moves
25 string_types: tuple[Type[str]]
26 integer_types: tuple[Type[int]]
27 class_types: tuple[Type[Type[Any]]]
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: ...
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]]: ...
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: ...
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: ...
66 def assertRaisesRegex(self: unittest.TestCase, msg: str | None = ...) -> Any: ...
68 def assertRaisesRegex(self: unittest.TestCase, callable_obj: Callable[..., Any], *args: Any, **kwargs: Any) -> Any: ...
70 self: unittest.TestCase, text: AnyStr, expected_regex: AnyStr | Pattern[AnyStr], msg: str | None = ...
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: ...
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: ...
89 def __init__(self, name: str) -> None: ...
90 def __get__(self, obj: object | None, type: Type[Any] | None = ...) -> Any: ...
92 class MovedModule(_LazyDescr):
94 def __init__(self, name: str, old: str, new: str | None = ...) -> None: ...
95 def __getattr__(self, attr: str) -> Any: ...
97 class MovedAttribute(_LazyDescr):
100 def __init__(self, name: str, old_mod: str, new_mod: str, old_attr: str | None = ..., new_attr: str | None = ...) -> None: ...
102 def add_move(move: MovedModule | MovedAttribute) -> None: ...
103 def remove_move(name: str) -> None: ...