1 # Stubs for six (Python 3.5)
\r
3 from __future__ import print_function
\r
29 from io import StringIO as StringIO, BytesIO as BytesIO
\r
30 from builtins import next as next
\r
31 from functools import wraps as wraps
\r
38 # TODO make constant, then move this stub to 2and3
\r
39 # https://github.com/python/typeshed/issues/17
\r
42 PY34 = ... # type: bool
\r
45 integer_types = int,
\r
50 MAXSIZE = ... # type: int
\r
55 def callable(obj: object) -> bool: ...
\r
57 def get_unbound_function(unbound: types.FunctionType) -> types.FunctionType: ...
\r
58 def create_bound_method(func: types.FunctionType, obj: object) -> types.MethodType: ...
\r
59 def create_unbound_method(func: types.FunctionType, cls: type) -> types.FunctionType: ...
\r
63 def get_method_function(meth: types.MethodType) -> types.FunctionType: ...
\r
64 def get_method_self(meth: types.MethodType) -> Optional[object]: ...
\r
65 def get_function_closure(fun: types.FunctionType) -> Optional[Tuple[types._Cell, ...]]: ...
\r
66 def get_function_code(fun: types.FunctionType) -> types.CodeType: ...
\r
67 def get_function_defaults(fun: types.FunctionType) -> Optional[Tuple[Any, ...]]: ...
\r
68 def get_function_globals(fun: types.FunctionType) -> Dict[str, Any]: ...
\r
70 def iterkeys(d: Mapping[_K, _V]) -> typing.Iterator[_K]: ...
\r
71 def itervalues(d: Mapping[_K, _V]) -> typing.Iterator[_V]: ...
\r
72 def iteritems(d: Mapping[_K, _V]) -> typing.Iterator[Tuple[_K, _V]]: ...
\r
75 def viewkeys(d: Mapping[_K, _V]) -> KeysView[_K]: ...
\r
76 def viewvalues(d: Mapping[_K, _V]) -> ValuesView[_V]: ...
\r
77 def viewitems(d: Mapping[_K, _V]) -> ItemsView[_K, _V]: ...
\r
79 def b(s: str) -> binary_type: ...
\r
80 def u(s: str) -> text_type: ...
\r
83 def int2byte(i: int) -> bytes: ...
\r
84 def byte2int(bs: binary_type) -> int: ...
\r
85 def indexbytes(buf: binary_type, i: int) -> int: ...
\r
86 def iterbytes(buf: binary_type) -> typing.Iterator[int]: ...
\r
88 def assertCountEqual(self: unittest.TestCase, first: Iterable[_T], second: Iterable[_T], msg: Optional[str] = ...) -> None: ...
\r
90 def assertRaisesRegex(self: unittest.TestCase, msg: Optional[str] = ...) -> Any: ...
\r
92 def assertRaisesRegex(self: unittest.TestCase, callable_obj: Callable[..., Any], *args: Any, **kwargs: Any) -> Any: ...
\r
93 def assertRegex(self: unittest.TestCase, text: AnyStr, expected_regex: Union[AnyStr, Pattern[AnyStr]], msg: Optional[str] = ...) -> None: ...
\r
97 def reraise(tp: Optional[Type[BaseException]], value: Optional[BaseException], tb: Optional[types.TracebackType] = ...) -> NoReturn: ...
\r
98 def raise_from(value: BaseException, from_value: Optional[BaseException]) -> NoReturn: ...
\r
102 def with_metaclass(meta: type, *bases: type) -> type: ...
\r
103 def add_metaclass(metaclass: type) -> Callable[[_T], _T]: ...
\r
104 def python_2_unicode_compatible(klass: _T) -> _T: ...
\r