mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-22 20:01:29 +08:00
@@ -806,3 +806,5 @@ def eval(s: str) -> Any: ...
|
||||
def cmp(x: Any, y: Any) -> int: ...
|
||||
|
||||
def execfile(filename: str, globals: Dict[str, Any] = None, locals: Dict[str, Any] = None) -> None: ...
|
||||
|
||||
class file(BinaryIO): ...
|
||||
|
||||
@@ -1,23 +1,52 @@
|
||||
# Stubs for types
|
||||
# Note, all classes "defined" here require special handling.
|
||||
|
||||
from typing import Any, Tuple, Optional
|
||||
from typing import (
|
||||
Any, Callable, Dict, Iterable, Iterator, List, Optional,
|
||||
Tuple, TypeVar, Union, overload,
|
||||
)
|
||||
|
||||
class ModuleType:
|
||||
__name__ = ... # type: str
|
||||
__file__ = ... # type: str
|
||||
def __init__(self, name: str, doc: str) -> None: ...
|
||||
_T = TypeVar('_T')
|
||||
|
||||
class TracebackType:
|
||||
...
|
||||
class NoneType: ...
|
||||
TypeType = type
|
||||
ObjectType = object
|
||||
|
||||
class FrameType:
|
||||
...
|
||||
IntType = int
|
||||
LongType = long
|
||||
FloatType = float
|
||||
BooleanType = bool
|
||||
ComplexType = complex
|
||||
StringType = str
|
||||
UnicodeType = unicode
|
||||
StringTypes = (StringType, UnicodeType)
|
||||
BufferType = buffer
|
||||
TupleType = tuple
|
||||
ListType = list
|
||||
DictType = DictionaryType = dict
|
||||
|
||||
class GeneratorType:
|
||||
...
|
||||
class _Cell:
|
||||
cell_contents = ... # type: Any
|
||||
|
||||
class ListType:
|
||||
...
|
||||
class FunctionType:
|
||||
func_closure = ... # type: Optional[Tuple[_Cell, ...]]
|
||||
func_code = ... # type: CodeType
|
||||
func_defaults = ... # type: Optional[Tuple[Any, ...]]
|
||||
func_dict = ... # type: Dict[str, Any]
|
||||
func_doc = ... # type: Optional[str]
|
||||
func_globals = ... # type: Dict[str, Any]
|
||||
func_name = ... # type: str
|
||||
__closure__ = func_closure
|
||||
__code__ = func_code
|
||||
__defaults__ = func_defaults
|
||||
__dict__ = func_dict
|
||||
__doc__ = func_doc
|
||||
__globals__ = func_globals
|
||||
__name__ = func_name
|
||||
def __call__(self, *args: Any, **kwargs: Any) -> Any: ...
|
||||
def __get__(self, obj: Optional[object], type: Optional[type]) -> 'UnboundMethodType': ...
|
||||
|
||||
LambdaType = FunctionType
|
||||
|
||||
class CodeType:
|
||||
co_argcount = ... # type: int
|
||||
@@ -34,3 +63,100 @@ class CodeType:
|
||||
co_nlocals= ... # type: int
|
||||
co_stacksize= ... # type: int
|
||||
co_varnames = ... # type: Tuple[str, ...]
|
||||
|
||||
class GeneratorType:
|
||||
gi_code = ... # type: CodeType
|
||||
gi_frame = ... # type: FrameType
|
||||
gi_running = ... # type: int
|
||||
def __iter__(self) -> 'GeneratorType': ...
|
||||
def close(self) -> None: ...
|
||||
def next(self) -> Any: ...
|
||||
def send(self, arg: Any) -> Any: ...
|
||||
@overload
|
||||
def throw(self, val: BaseException) -> Any: ...
|
||||
@overload
|
||||
def throw(self, typ: type, val: BaseException = ..., tb: 'TracebackType' = ...) -> Any: ...
|
||||
|
||||
class ClassType: ...
|
||||
class UnboundMethodType:
|
||||
im_class = ... # type: type
|
||||
im_func = ... # type: FunctionType
|
||||
im_self = ... # type: Optional[object]
|
||||
__func__ = im_func
|
||||
__self__ = im_self
|
||||
def __call__(self, *args: Any, **kwargs: Any) -> Any: ...
|
||||
class InstanceType: ...
|
||||
MethodType = UnboundMethodType
|
||||
|
||||
class BuiltinFunctionType:
|
||||
__self__ = ... # type: Optional[object]
|
||||
def __call__(self, *args: Any, **kwargs: Any) -> Any: ...
|
||||
BuiltinMethodType = BuiltinFunctionType
|
||||
|
||||
class ModuleType:
|
||||
__doc__ = ... # type: Optional[str]
|
||||
__file__ = ... # type: Optional[str]
|
||||
__name__ = ... # type: str
|
||||
__package__ = ... # type: Optional[str]
|
||||
__path__ = ... # type: Optional[Iterable[str]]
|
||||
def __init__(self, name: str, doc: str) -> None: ...
|
||||
FileType = file
|
||||
XRangeType = xrange
|
||||
|
||||
class TracebackType:
|
||||
tb_frame = ... # type: FrameType
|
||||
tb_lasti = ... # type: int
|
||||
tb_lineno = ... # type: int
|
||||
tb_next = ... # type: TracebackType
|
||||
|
||||
class FrameType:
|
||||
f_back = ... # type: FrameType
|
||||
f_builtins = ... # type: Dict[str, Any]
|
||||
f_code = ... # type: CodeType
|
||||
f_exc_type = ... # type: None
|
||||
f_exc_value = ... # type: None
|
||||
f_exc_traceback = ... # type: None
|
||||
f_globals = ... # type: Dict[str, Any]
|
||||
f_lasti = ... # type: int
|
||||
f_lineno = ... # type: int
|
||||
f_locals = ... # type: Dict[str, Any]
|
||||
f_restricted = ... # type: bool
|
||||
f_trace = ... # type: Callable[[], None]
|
||||
|
||||
def clear(self) -> None: pass
|
||||
|
||||
SliceType = slice
|
||||
class EllipsisType: ...
|
||||
|
||||
class DictProxyType:
|
||||
# TODO is it possible to have non-string keys?
|
||||
# no __init__
|
||||
def copy(self) -> dict: ...
|
||||
def get(self, key: str, default: _T = None) -> Union[Any, _T]: ...
|
||||
def has_key(self, key: str) -> bool: ...
|
||||
def items(self) -> List[Tuple[str, Any]]: ...
|
||||
def iteritems(self) -> Iterator[Tuple[str, Any]]: ...
|
||||
def iterkeys(self) -> Iterator[str]: ...
|
||||
def itervalues(self) -> Iterator[Any]: ...
|
||||
def keys(self) -> List[str]: ...
|
||||
def values(self) -> List[Any]: ...
|
||||
def __contains__(self, key: str) -> bool: ...
|
||||
def __getitem__(self, key: str) -> Any: ...
|
||||
def __iter__(self) -> Iterator[str]: ...
|
||||
def __len__(self) -> int: ...
|
||||
|
||||
class NotImplementedType: ...
|
||||
|
||||
class GetSetDescriptorType:
|
||||
__name__ = ... # type: str
|
||||
__objclass__ = ... # type: type
|
||||
def __get__(self, obj: Any, type: type = None) -> Any: ...
|
||||
def __set__(self, obj: Any) -> None: ...
|
||||
def __delete__(self, obj: Any) -> None: ...
|
||||
# Same type on Jython, different on CPython and PyPy, unknown on IronPython.
|
||||
class MemberDescriptorType:
|
||||
__name__ = ... # type: str
|
||||
__objclass__ = ... # type: type
|
||||
def __get__(self, obj: Any, type: type = None) -> Any: ...
|
||||
def __set__(self, obj: Any) -> None: ...
|
||||
def __delete__(self, obj: Any) -> None: ...
|
||||
|
||||
@@ -1,16 +1,26 @@
|
||||
# Stubs for types
|
||||
# Note, all classes "defined" here require special handling.
|
||||
|
||||
# TODO this is work in progress
|
||||
# TODO parts of this should be conditional on version
|
||||
|
||||
from typing import Any, Callable, Dict, Sequence, Optional, Tuple
|
||||
from typing import Any, Callable, Dict, Iterator, Optional, Tuple, TypeVar, Union, overload
|
||||
|
||||
class ModuleType:
|
||||
__name__ = ... # type: str
|
||||
__file__ = ... # type: str
|
||||
def __init__(self, name: str, doc: Any) -> None: ...
|
||||
_T = TypeVar('_T')
|
||||
|
||||
class MethodType: ...
|
||||
class BuiltinMethodType: ...
|
||||
class _Cell:
|
||||
cell_contents = ... # type: Any
|
||||
|
||||
class FunctionType:
|
||||
__closure__ = ... # type: Optional[Tuple[_Cell, ...]]
|
||||
__code__ = ... # type: CodeType
|
||||
__defaults__ = ... # type: Optional[Tuple[Any, ...]]
|
||||
__dict__ = ... # type: Dict[str, Any]
|
||||
__doc__ = ... # type: Optional[str]
|
||||
__globals__ = ... # type: Dict[str, Any]
|
||||
__name__ = ... # type: str
|
||||
def __call__(self, *args: Any, **kwargs: Any) -> Any: ...
|
||||
def __get__(self, obj: Optional[object], type: Optional[type]) -> 'MethodType': ...
|
||||
LambdaType = FunctionType
|
||||
|
||||
class CodeType:
|
||||
"""Create a code object. Not for the faint of heart."""
|
||||
@@ -47,6 +57,64 @@ class CodeType:
|
||||
cellvars: Tuple[str, ...] = (),
|
||||
) -> None: ...
|
||||
|
||||
class MappingProxyType:
|
||||
def copy(self) -> dict: ...
|
||||
def get(self, key: str, default: _T = None) -> Union[Any, _T]: ...
|
||||
def items(self) -> Iterator[Tuple[str, Any]]: ...
|
||||
def keys(self) -> Iterator[str]: ...
|
||||
def values(self) -> Iterator[Any]: ...
|
||||
def __contains__(self, key: str) -> bool: ...
|
||||
def __getitem__(self, key: str) -> Any: ...
|
||||
def __iter__(self) -> Iterator[str]: ...
|
||||
def __len__(self) -> int: ...
|
||||
class SimpleNamespace: ...
|
||||
|
||||
class GeneratorType:
|
||||
gi_code = ... # type: CodeType
|
||||
gi_frame = ... # type: FrameType
|
||||
gi_running = ... # type: bool
|
||||
gi_yieldfrom = ... # type: Optional[GeneratorType]
|
||||
def __iter__(self) -> 'GeneratorType': ...
|
||||
def __next__(self) -> Any: ...
|
||||
def close(self) -> None: ...
|
||||
def send(self, arg: Any) -> Any: ...
|
||||
@overload
|
||||
def throw(self, val: BaseException) -> Any: ...
|
||||
@overload
|
||||
def throw(self, typ: type, val: BaseException = ..., tb: 'TracebackType' = ...) -> Any: ...
|
||||
|
||||
class CoroutineType:
|
||||
cr_await = ... # type: Optional[Any]
|
||||
cr_code = ... # type: CodeType
|
||||
cr_frame = ... # type: FrameType
|
||||
cr_running = ... # type: bool
|
||||
def close(self) -> None: ...
|
||||
def send(self, arg: Any) -> Any: ...
|
||||
@overload
|
||||
def throw(self, val: BaseException) -> Any: ...
|
||||
@overload
|
||||
def throw(self, typ: type, val: BaseException = ..., tb: 'TracebackType' = ...) -> Any: ...
|
||||
|
||||
class MethodType:
|
||||
__func__ = ... # type: FunctionType
|
||||
__self__ = ... # type: object
|
||||
def __call__(self, *args: Any, **kwargs: Any) -> Any: ...
|
||||
class BuiltinFunctionType:
|
||||
__self__ = ... # type: Union[object, ModuleType]
|
||||
def __call__(self, *args: Any, **kwargs: Any) -> Any: ...
|
||||
BuiltinMethodType = BuiltinFunctionType
|
||||
|
||||
class ModuleType:
|
||||
__name__ = ... # type: str
|
||||
__file__ = ... # type: str
|
||||
def __init__(self, name: str, doc: Any) -> None: ...
|
||||
|
||||
class TracebackType:
|
||||
tb_frame = ... # type: FrameType
|
||||
tb_lasti = ... # type: int
|
||||
tb_lineno = ... # type: int
|
||||
tb_next = ... # type: TracebackType
|
||||
|
||||
class FrameType:
|
||||
f_back = ... # type: FrameType
|
||||
f_builtins = ... # type: Dict[str, Any]
|
||||
@@ -59,8 +127,23 @@ class FrameType:
|
||||
|
||||
def clear(self) -> None: pass
|
||||
|
||||
class TracebackType:
|
||||
tb_frame = ... # type: FrameType
|
||||
tb_lasti = ... # type: int
|
||||
tb_lineno = ... # type: int
|
||||
tb_next = ... # type: TracebackType
|
||||
class GetSetDescriptorType:
|
||||
__name__ = ... # type: str
|
||||
__objclass__ = ... # type: type
|
||||
def __get__(self, obj: Any, type: type = None) -> Any: ...
|
||||
def __set__(self, obj: Any) -> None: ...
|
||||
def __delete__(self, obj: Any) -> None: ...
|
||||
class MemberDescriptorType:
|
||||
__name__ = ... # type: str
|
||||
__objclass__ = ... # type: type
|
||||
def __get__(self, obj: Any, type: type = None) -> Any: ...
|
||||
def __set__(self, obj: Any) -> None: ...
|
||||
def __delete__(self, obj: Any) -> None: ...
|
||||
|
||||
def new_class(name: str, bases: Tuple[type, ...] = (), kwds: Dict[str, Any] = None, exec_body: Callable[[Dict[str, Any]], None] = None) -> type: ...
|
||||
def prepare_class(name: str, bases: Tuple[type, ...] = (), kwds: Dict[str, Any] = None) -> Tuple[type, Dict[str, Any], Dict[str, Any]]: ...
|
||||
|
||||
# Actually a different type, but `property` is special and we want that too.
|
||||
DynamicClassAttribute = property
|
||||
|
||||
def coroutine(f: Callable[..., Any]) -> CoroutineType: ...
|
||||
|
||||
90
third_party/2.7/six/__init__.pyi
vendored
Normal file
90
third_party/2.7/six/__init__.pyi
vendored
Normal file
@@ -0,0 +1,90 @@
|
||||
# Stubs for six (Python 2.7)
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
from typing import (
|
||||
Any, AnyStr, Callable, Iterable, Mapping, Optional,
|
||||
Pattern, Tuple, TypeVar, Union, overload,
|
||||
)
|
||||
import typing
|
||||
|
||||
import unittest
|
||||
import types
|
||||
|
||||
_T = TypeVar('_T')
|
||||
_K = TypeVar('_K')
|
||||
_V = TypeVar('_V')
|
||||
|
||||
# TODO make constant, then move this stub to 2and3
|
||||
# https://github.com/python/typeshed/issues/17
|
||||
PY2 = True
|
||||
PY3 = False
|
||||
PY34 = False
|
||||
|
||||
string_types = basestring,
|
||||
integer_types = (int, long)
|
||||
class_types = (type, types.ClassType)
|
||||
text_type = unicode
|
||||
binary_type = str
|
||||
|
||||
MAXSIZE = ... # type: int
|
||||
|
||||
#def add_move
|
||||
#def remove_move
|
||||
|
||||
def advance_iterator(it: typing.Iterator[_T]) -> _T: ...
|
||||
next = advance_iterator
|
||||
|
||||
def callable(obj: object) -> bool: ...
|
||||
|
||||
def get_unbound_function(unbound: types.MethodType) -> types.FunctionType: ...
|
||||
def create_bound_method(func: types.FunctionType, obj: object) -> types.MethodType: ...
|
||||
def create_unbound_method(func: types.FunctionType, cls: Union[type, types.ClassType]) -> types.MethodType: ...
|
||||
|
||||
class Iterator:
|
||||
def next(self) -> Any: ...
|
||||
|
||||
def get_method_function(meth: types.MethodType) -> types.FunctionType: ...
|
||||
def get_method_self(meth: types.MethodType) -> Optional[object]: ...
|
||||
def get_function_closure(fun: types.FunctionType) -> Optional[Tuple[types._Cell, ...]]: ...
|
||||
def get_function_code(fun: types.FunctionType) -> types.CodeType: ...
|
||||
def get_function_defaults(fun: types.FunctionType) -> Optional[Tuple[Any, ...]]: ...
|
||||
def get_function_globals(fun: types.FunctionType) -> Dict[str, Any]: ...
|
||||
|
||||
def iterkeys(d: Mapping[_K, _V]) -> typing.Iterator[_K]: ...
|
||||
def itervalues(d: Mapping[_K, _V]) -> typing.Iterator[_V]: ...
|
||||
def iteritems(d: Mapping[_K, _V]) -> typing.Iterator[Tuple[_K, _V]]: ...
|
||||
#def iterlists
|
||||
|
||||
# TODO fix return types - python2 typing doesn't include KeysView etc yet.
|
||||
def viewkeys(d: Mapping[_K, _V]) -> Iterable[_K]: ...
|
||||
def viewvalues(d: Mapping[_K, _V]) -> Iterable[_V]: ...
|
||||
def viewitems(d: Mapping[_K, _V]) -> Iterable[Tuple[_K, _V]]: ...
|
||||
|
||||
def b(s: str) -> binary_type: ...
|
||||
def u(s: str) -> text_type: ...
|
||||
from __builtin__ import unichr as unichr
|
||||
int2byte = chr
|
||||
def byte2int(bs: binary_type) -> int: ...
|
||||
def indexbytes(buf: binary_type, i: int) -> int: ...
|
||||
def iterbytes(buf: binary_type) -> typing.Iterator[int]: ...
|
||||
from StringIO import StringIO as StringIO, StringIO as BytesIO
|
||||
|
||||
def assertCountEqual(self: unittest.TestCase, first: Iterable[_T], second: Iterable[_T], msg: str = None) -> None: ...
|
||||
@overload
|
||||
def assertRaisesRegex(self: unittest.TestCase, msg: str = None) -> Any: ...
|
||||
@overload
|
||||
def assertRaisesRegex(self: unittest.TestCase, callable_obj: Callable[..., Any], *args: Any, **kwargs: Any) -> Any: ...
|
||||
def assertRegex(self: unittest.TestCase, text: AnyStr, expected_regex: Union[AnyStr, Pattern[AnyStr]], msg: str = None) -> None: ...
|
||||
|
||||
def reraise(tp: type, value: Optional[BaseException], tb: types.TracebackType = None) -> None: ...
|
||||
def exec_(_code_: Union[unicode, types.CodeType], _globs_: Dict[str, Any] = None, _locs_: Dict[str, Any] = None): ...
|
||||
def raise_from(value: BaseException, from_value: BaseException) -> None: ...
|
||||
|
||||
print_ = print
|
||||
|
||||
from functools import wraps as wraps
|
||||
|
||||
def with_metaclass(meta: type, *bases: type) -> type: ...
|
||||
def add_metaclass(metaclass: type) -> Callable[[_T], _T]: ...
|
||||
def python_2_unicode_compatible(klass: _T) -> _T: ...
|
||||
103
third_party/3/six/__init__.pyi
vendored
Normal file
103
third_party/3/six/__init__.pyi
vendored
Normal file
@@ -0,0 +1,103 @@
|
||||
# Stubs for six (Python 3.5)
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
from typing import (
|
||||
Any,
|
||||
AnyStr,
|
||||
Callable,
|
||||
Dict,
|
||||
ItemsView,
|
||||
Iterable,
|
||||
KeysView,
|
||||
Mapping,
|
||||
Optional,
|
||||
Pattern,
|
||||
Tuple,
|
||||
TypeVar,
|
||||
Union,
|
||||
ValuesView,
|
||||
overload,
|
||||
)
|
||||
import typing
|
||||
|
||||
import unittest
|
||||
import types
|
||||
|
||||
_T = TypeVar('_T')
|
||||
_K = TypeVar('_K')
|
||||
_V = TypeVar('_V')
|
||||
|
||||
# TODO make constant, then move this stub to 2and3
|
||||
# https://github.com/python/typeshed/issues/17
|
||||
PY2 = False
|
||||
PY3 = True
|
||||
PY34 = ... # type: bool
|
||||
|
||||
string_types = str,
|
||||
integer_types = int,
|
||||
class_types = type,
|
||||
text_type = str
|
||||
binary_type = bytes
|
||||
|
||||
MAXSIZE = ... # type: int
|
||||
|
||||
#def add_move
|
||||
#def remove_move
|
||||
|
||||
from builtins import next as advance_iterator
|
||||
next = advance_iterator
|
||||
|
||||
def callable(obj: object) -> bool: ...
|
||||
|
||||
def get_unbound_function(unbound: types.FunctionType) -> types.FunctionType: ...
|
||||
def create_bound_method(func: types.FunctionType, obj: object) -> types.MethodType: ...
|
||||
def create_unbound_method(func: types.FunctionType, cls: type) -> types.FunctionType: ...
|
||||
|
||||
Iterator = object
|
||||
|
||||
def get_method_function(meth: types.MethodType) -> types.FunctionType: ...
|
||||
def get_method_self(meth: types.MethodType) -> Optional[object]: ...
|
||||
def get_function_closure(fun: types.FunctionType) -> Optional[Tuple[types._Cell, ...]]: ...
|
||||
def get_function_code(fun: types.FunctionType) -> types.CodeType: ...
|
||||
def get_function_defaults(fun: types.FunctionType) -> Optional[Tuple[Any, ...]]: ...
|
||||
def get_function_globals(fun: types.FunctionType) -> Dict[str, Any]: ...
|
||||
|
||||
def iterkeys(d: Mapping[_K, _V]) -> typing.Iterator[_K]: ...
|
||||
def itervalues(d: Mapping[_K, _V]) -> typing.Iterator[_V]: ...
|
||||
def iteritems(d: Mapping[_K, _V]) -> typing.Iterator[Tuple[_K, _V]]: ...
|
||||
#def iterlists
|
||||
|
||||
def viewkeys(d: Mapping[_K, _V]) -> KeysView[_K]: ...
|
||||
def viewvalues(d: Mapping[_K, _V]) -> ValuesView[_V]: ...
|
||||
def viewitems(d: Mapping[_K, _V]) -> ItemsView[_K, _V]: ...
|
||||
|
||||
def b(s: str) -> binary_type: ...
|
||||
def u(s: str) -> text_type: ...
|
||||
|
||||
unichr = chr
|
||||
def int2byte(i: int) -> bytes: ...
|
||||
def byte2int(bs: binary_type) -> int: ...
|
||||
def indexbytes(buf: binary_type, i: int) -> int: ...
|
||||
def iterbytes(buf: binary_type) -> typing.Iterator[int]: ...
|
||||
from io import StringIO as StringIO, BytesIO as BytesIO
|
||||
|
||||
def assertCountEqual(self: unittest.TestCase, first: Iterable[_T], second: Iterable[_T], msg: str = None) -> None: ...
|
||||
@overload
|
||||
def assertRaisesRegex(self: unittest.TestCase, msg: str = None) -> Any: ...
|
||||
@overload
|
||||
def assertRaisesRegex(self: unittest.TestCase, callable_obj: Callable[..., Any], *args: Any, **kwargs: Any) -> Any: ...
|
||||
def assertRegex(self: unittest.TestCase, text: AnyStr, expected_regex: Union[AnyStr, Pattern[AnyStr]], msg: str = None) -> None: ...
|
||||
|
||||
exec_ = exec
|
||||
|
||||
def reraise(tp: type, value: Optional[BaseException], tb: types.TracebackType = None) -> None: ...
|
||||
def raise_from(value: BaseException, from_value: BaseException) -> None: ...
|
||||
|
||||
print_ = print
|
||||
|
||||
from functools import wraps as wraps
|
||||
|
||||
def with_metaclass(meta: type, *bases: type) -> type: ...
|
||||
def add_metaclass(metaclass: type) -> Callable[[_T], _T]: ...
|
||||
def python_2_unicode_compatible(klass: _T) -> _T: ...
|
||||
Reference in New Issue
Block a user