--- /dev/null
+# Stubs for types\r
+# Note, all classes "defined" here require special handling.\r
+\r
+from typing import (\r
+ Any, Callable, Dict, Iterable, Iterator, List, Optional,\r
+ Tuple, Type, TypeVar, Union, overload,\r
+)\r
+\r
+_T = TypeVar('_T')\r
+\r
+class NoneType: ...\r
+TypeType = type\r
+ObjectType = object\r
+\r
+IntType = int\r
+LongType = int # Really long, but can't reference that due to a mypy import cycle\r
+FloatType = float\r
+BooleanType = bool\r
+ComplexType = complex\r
+StringType = str\r
+UnicodeType = unicode\r
+StringTypes = ... # type: Tuple[Type[StringType], Type[UnicodeType]]\r
+BufferType = buffer\r
+TupleType = tuple\r
+ListType = list\r
+DictType = dict\r
+DictionaryType = dict\r
+\r
+class _Cell:\r
+ cell_contents = ... # type: Any\r
+\r
+class FunctionType:\r
+ func_closure = ... # type: Optional[Tuple[_Cell, ...]]\r
+ func_code = ... # type: CodeType\r
+ func_defaults = ... # type: Optional[Tuple[Any, ...]]\r
+ func_dict = ... # type: Dict[str, Any]\r
+ func_doc = ... # type: Optional[str]\r
+ func_globals = ... # type: Dict[str, Any]\r
+ func_name = ... # type: str\r
+ __closure__ = func_closure\r
+ __code__ = func_code\r
+ __defaults__ = func_defaults\r
+ __dict__ = func_dict\r
+ __globals__ = func_globals\r
+ __name__ = func_name\r
+ def __call__(self, *args: Any, **kwargs: Any) -> Any: ...\r
+ def __get__(self, obj: Optional[object], type: Optional[type]) -> 'UnboundMethodType': ...\r
+\r
+LambdaType = FunctionType\r
+\r
+class CodeType:\r
+ co_argcount = ... # type: int\r
+ co_cellvars = ... # type: Tuple[str, ...]\r
+ co_code = ... # type: str\r
+ co_consts = ... # type: Tuple[Any, ...]\r
+ co_filename = ... # type: Optional[str]\r
+ co_firstlineno = ... # type: int\r
+ co_flags = ... # type: int\r
+ co_freevars = ... # type: Tuple[str, ...]\r
+ co_lnotab = ... # type: str\r
+ co_name = ... # type: str\r
+ co_names = ... # type: Tuple[str, ...]\r
+ co_nlocals = ... # type: int\r
+ co_stacksize = ... # type: int\r
+ co_varnames = ... # type: Tuple[str, ...]\r
+\r
+class GeneratorType:\r
+ gi_code = ... # type: CodeType\r
+ gi_frame = ... # type: FrameType\r
+ gi_running = ... # type: int\r
+ def __iter__(self) -> 'GeneratorType': ...\r
+ def close(self) -> None: ...\r
+ def next(self) -> Any: ...\r
+ def send(self, arg: Any) -> Any: ...\r
+ @overload\r
+ def throw(self, val: BaseException) -> Any: ...\r
+ @overload\r
+ def throw(self, typ: type, val: BaseException = ..., tb: 'TracebackType' = ...) -> Any: ...\r
+\r
+class ClassType: ...\r
+class UnboundMethodType:\r
+ im_class = ... # type: type\r
+ im_func = ... # type: FunctionType\r
+ im_self = ... # type: object\r
+ __name__ = ... # type: str\r
+ __func__ = im_func\r
+ __self__ = im_self\r
+ def __init__(self, func: Callable, obj: object) -> None: ...\r
+ def __call__(self, *args: Any, **kwargs: Any) -> Any: ...\r
+\r
+class InstanceType:\r
+ __doc__ = ... # type: Optional[str]\r
+ __class__ = ... # type: type\r
+ __module__ = ... # type: Any\r
+\r
+MethodType = UnboundMethodType\r
+\r
+class BuiltinFunctionType:\r
+ __self__ = ... # type: Optional[object]\r
+ def __call__(self, *args: Any, **kwargs: Any) -> Any: ...\r
+BuiltinMethodType = BuiltinFunctionType\r
+\r
+class ModuleType:\r
+ __doc__ = ... # type: Optional[str]\r
+ __file__ = ... # type: Optional[str]\r
+ __name__ = ... # type: str\r
+ __package__ = ... # type: Optional[str]\r
+ __path__ = ... # type: Optional[Iterable[str]]\r
+ __dict__ = ... # type: Dict[str, Any]\r
+ def __init__(self, name: str, doc: Optional[str] = ...) -> None: ...\r
+FileType = file\r
+XRangeType = xrange\r
+\r
+class TracebackType:\r
+ tb_frame = ... # type: FrameType\r
+ tb_lasti = ... # type: int\r
+ tb_lineno = ... # type: int\r
+ tb_next = ... # type: TracebackType\r
+\r
+class FrameType:\r
+ f_back = ... # type: FrameType\r
+ f_builtins = ... # type: Dict[str, Any]\r
+ f_code = ... # type: CodeType\r
+ f_exc_type = ... # type: None\r
+ f_exc_value = ... # type: None\r
+ f_exc_traceback = ... # type: None\r
+ f_globals = ... # type: Dict[str, Any]\r
+ f_lasti = ... # type: int\r
+ f_lineno = ... # type: int\r
+ f_locals = ... # type: Dict[str, Any]\r
+ f_restricted = ... # type: bool\r
+ f_trace = ... # type: Callable[[], None]\r
+\r
+ def clear(self) -> None: ...\r
+\r
+SliceType = slice\r
+class EllipsisType: ...\r
+\r
+class DictProxyType:\r
+ # TODO is it possible to have non-string keys?\r
+ # no __init__\r
+ def copy(self) -> dict: ...\r
+ def get(self, key: str, default: _T = ...) -> Union[Any, _T]: ...\r
+ def has_key(self, key: str) -> bool: ...\r
+ def items(self) -> List[Tuple[str, Any]]: ...\r
+ def iteritems(self) -> Iterator[Tuple[str, Any]]: ...\r
+ def iterkeys(self) -> Iterator[str]: ...\r
+ def itervalues(self) -> Iterator[Any]: ...\r
+ def keys(self) -> List[str]: ...\r
+ def values(self) -> List[Any]: ...\r
+ def __contains__(self, key: str) -> bool: ...\r
+ def __getitem__(self, key: str) -> Any: ...\r
+ def __iter__(self) -> Iterator[str]: ...\r
+ def __len__(self) -> int: ...\r
+\r
+class NotImplementedType: ...\r
+\r
+class GetSetDescriptorType:\r
+ __name__ = ... # type: str\r
+ __objclass__ = ... # type: type\r
+ def __get__(self, obj: Any, type: type = ...) -> Any: ...\r
+ def __set__(self, obj: Any) -> None: ...\r
+ def __delete__(self, obj: Any) -> None: ...\r
+# Same type on Jython, different on CPython and PyPy, unknown on IronPython.\r
+class MemberDescriptorType:\r
+ __name__ = ... # type: str\r
+ __objclass__ = ... # type: type\r
+ def __get__(self, obj: Any, type: type = ...) -> Any: ...\r
+ def __set__(self, obj: Any) -> None: ...\r
+ def __delete__(self, obj: Any) -> None: ...\r