1 # Stubs for xmlrpclib (Python 2)
\r
3 from typing import Any, AnyStr, Callable, IO, Iterable, List, Mapping, MutableMapping, Optional, Tuple, Type, TypeVar, Union
\r
4 from types import InstanceType
\r
5 from datetime import datetime
\r
6 from time import struct_time
\r
7 from httplib import HTTPConnection, HTTPResponse, HTTPSConnection
\r
8 from ssl import SSLContext
\r
9 from StringIO import StringIO
\r
10 from gzip import GzipFile
\r
13 _timeTuple = Tuple[int, int, int, int, int, int, int, int, int]
\r
14 # Represents types that can be compared against a DateTime object
\r
15 _dateTimeComp = Union[AnyStr, DateTime, datetime, _timeTuple]
\r
16 # A "host description" used by Transport factories
\r
17 _hostDesc = Union[str, Tuple[str, Mapping[Any, Any]]]
\r
19 def escape(s: AnyStr, replace: Callable[[AnyStr, AnyStr, AnyStr], AnyStr] = ...) -> AnyStr: ...
\r
21 MAXINT = ... # type: int
\r
22 MININT = ... # type: int
\r
23 PARSE_ERROR = ... # type: int
\r
24 SERVER_ERROR = ... # type: int
\r
25 APPLICATION_ERROR = ... # type: int
\r
26 SYSTEM_ERROR = ... # type: int
\r
27 TRANSPORT_ERROR = ... # type: int
\r
28 NOT_WELLFORMED_ERROR = ... # type: int
\r
29 UNSUPPORTED_ENCODING = ... # type: int
\r
30 INVALID_ENCODING_CHAR = ... # type: int
\r
31 INVALID_XMLRPC = ... # type: int
\r
32 METHOD_NOT_FOUND = ... # type: int
\r
33 INVALID_METHOD_PARAMS = ... # type: int
\r
34 INTERNAL_ERROR = ... # type: int
\r
36 class Error(Exception): ...
\r
38 class ProtocolError(Error):
\r
39 url = ... # type: str
\r
40 errcode = ... # type: int
\r
41 errmsg = ... # type: str
\r
42 headers = ... # type: Any
\r
43 def __init__(self, url: str, errcode: int, errmsg: str, headers: Any) -> None: ...
\r
45 class ResponseError(Error): ...
\r
48 faultCode = ... # type: Any
\r
49 faultString = ... # type: str
\r
50 def __init__(self, faultCode: Any, faultString: str, **extra: Any) -> None: ...
\r
52 boolean = ... # type: Type[bool]
\r
53 Boolean = ... # type: Type[bool]
\r
56 value = ... # type: str
\r
57 def __init__(self, value: Union[str, unicode, datetime, float, int, _timeTuple, struct_time] = ...) -> None: ...
\r
58 def make_comparable(self, other: _dateTimeComp) -> Tuple[_dateTimeComp, _dateTimeComp]: ...
\r
59 def __lt__(self, other: _dateTimeComp) -> bool: ...
\r
60 def __le__(self, other: _dateTimeComp) -> bool: ...
\r
61 def __gt__(self, other: _dateTimeComp) -> bool: ...
\r
62 def __ge__(self, other: _dateTimeComp) -> bool: ...
\r
63 def __eq__(self, other: _dateTimeComp) -> bool: ...
\r
64 def __ne__(self, other: _dateTimeComp) -> bool: ...
\r
65 def timetuple(self) -> struct_time: ...
\r
66 def __cmp__(self, other: _dateTimeComp) -> int: ...
\r
67 def decode(self, data: Any) -> None: ...
\r
68 def encode(self, out: IO) -> None: ...
\r
71 data = ... # type: str
\r
72 def __init__(self, data: Optional[str] = ...) -> None: ...
\r
73 def __cmp__(self, other: Any) -> int: ...
\r
74 def decode(self, data: str) -> None: ...
\r
75 def encode(self, out: IO) -> None: ...
\r
77 WRAPPERS = ... # type: tuple
\r
79 # Still part of the public API, but see http://bugs.python.org/issue1773632
\r
80 FastParser = ... # type: None
\r
81 FastUnmarshaller = ... # type: None
\r
82 FastMarshaller = ... # type: None
\r
84 # xmlrpclib.py will leave ExpatParser undefined if it can't import expat from
\r
85 # xml.parsers. Because this is Python 2.7, the import will succeed.
\r
87 def __init__(self, target: _Unmarshaller) -> None: ...
\r
88 def feed(self, data: str): ...
\r
89 def close(self): ...
\r
91 # TODO: Add xmllib.XMLParser as base class
\r
93 handle_xml = ... # type: Callable[[str, bool], None]
\r
94 unknown_starttag = ... # type: Callable[[str, Any], None]
\r
95 handle_data = ... # type: Callable[[str], None]
\r
96 handle_cdata = ... # type: Callable[[str], None]
\r
97 unknown_endtag = ... # type: Callable[[str, Callable[[Iterable[str], str], str]], None]
\r
98 def __init__(self, target: _Unmarshaller) -> None: ...
\r
101 memo = ... # type: MutableMapping[int, Any]
\r
102 data = ... # type: Optional[str]
\r
103 encoding = ... # type: Optional[str]
\r
104 allow_none = ... # type: bool
\r
105 def __init__(self, encoding: Optional[str] = ..., allow_none: bool = ...) -> None: ...
\r
106 dispatch = ... # type: Mapping[type, Callable[[Marshaller, str, Callable[[str], None]], None]]
\r
107 def dumps(self, values: Union[Iterable[Union[None, int, bool, long, float, str, unicode, List, Tuple, Mapping, datetime, InstanceType]], Fault]) -> str: ...
\r
108 def dump_nil(self, value: None, write: Callable[[str], None]) -> None: ...
\r
109 def dump_int(self, value: int, write: Callable[[str], None]) -> None: ...
\r
110 def dump_bool(self, value: bool, write: Callable[[str], None]) -> None: ...
\r
111 def dump_long(self, value: long, write: Callable[[str], None]) -> None: ...
\r
112 def dump_double(self, value: float, write: Callable[[str], None]) -> None: ...
\r
113 def dump_string(self, value: str, write: Callable[[str], None], escape: Callable[[AnyStr, Callable[[AnyStr, AnyStr, AnyStr], AnyStr]], AnyStr] = ...) -> None: ...
\r
114 def dump_unicode(self, value: unicode, write: Callable[[str], None], escape: Callable[[AnyStr, Callable[[AnyStr, AnyStr, AnyStr], AnyStr]], AnyStr] = ...) -> None: ...
\r
115 def dump_array(self, value: Union[List, Tuple], write: Callable[[str], None]) -> None: ...
\r
116 def dump_struct(self, value: Mapping, write: Callable[[str], None], escape: Callable[[AnyStr, Callable[[AnyStr, AnyStr, AnyStr], AnyStr]], AnyStr] = ...) -> None: ...
\r
117 def dump_datetime(self, value: datetime, write: Callable[[str], None]) -> None: ...
\r
118 def dump_instance(self, value: InstanceType, write: Callable[[str], None]) -> None: ...
\r
120 class Unmarshaller:
\r
121 def append(self, object: Any) -> None: ...
\r
122 def __init__(self, use_datetime: bool = ...) -> None: ...
\r
123 def close(self) -> tuple: ...
\r
124 def getmethodname(self) -> Optional[str]: ...
\r
125 def xml(self, encoding: str, standalone: bool) -> None: ...
\r
126 def start(self, tag: str, attrs: Any) -> None: ...
\r
127 def data(self, text: str) -> None: ...
\r
128 def end(self, tag: str, join: Callable[[Iterable[str], str], str] = ...) -> None: ...
\r
129 def end_dispatch(self, tag: str, data: str) -> None: ...
\r
130 dispatch = ... # type: Mapping[str, Callable[[Unmarshaller, str], None]]
\r
131 def end_nil(self, data: str): ...
\r
132 def end_boolean(self, data: str) -> None: ...
\r
133 def end_int(self, data: str) -> None: ...
\r
134 def end_double(self, data: str) -> None: ...
\r
135 def end_string(self, data: str) -> None: ...
\r
136 def end_array(self, data: str) -> None: ...
\r
137 def end_struct(self, data: str) -> None: ...
\r
138 def end_base64(self, data: str) -> None: ...
\r
139 def end_dateTime(self, data: str) -> None: ...
\r
140 def end_value(self, data: str) -> None: ...
\r
141 def end_params(self, data: str) -> None: ...
\r
142 def end_fault(self, data: str) -> None: ...
\r
143 def end_methodName(self, data: str) -> None: ...
\r
145 class _MultiCallMethod:
\r
146 def __init__(self, call_list: List[Tuple[str, tuple]], name: str) -> None: ...
\r
147 class MultiCallIterator:
\r
148 def __init__(self, results: List) -> None: ...
\r
151 def __init__(self, server: ServerProxy) -> None: ...
\r
152 def __getattr__(self, name: str) -> _MultiCallMethod: ...
\r
153 def __call__(self) -> MultiCallIterator: ...
\r
155 def getparser(use_datetime: bool = ...) -> Tuple[Union[ExpatParser, SlowParser], Unmarshaller]: ...
\r
156 def dumps(params: Union[tuple, Fault], methodname: Optional[str] = ..., methodresponse: Optional[bool] = ..., encoding: Optional[str] = ..., allow_none: bool = ...) -> str: ...
\r
157 def loads(data: str, use_datetime: bool = ...) -> Tuple[tuple, Optional[str]]: ...
\r
159 def gzip_encode(data: str) -> str: ...
\r
160 def gzip_decode(data: str, max_decode: int = ...) -> str: ...
\r
162 class GzipDecodedResponse(GzipFile):
\r
163 stringio = ... # type: StringIO
\r
164 def __init__(self, response: HTTPResponse) -> None: ...
\r
165 def close(self): ...
\r
168 def __init__(self, send: Callable[[str, tuple], Any], name: str) -> None: ...
\r
169 def __getattr__(self, name: str) -> _Method: ...
\r
170 def __call__(self, *args: Any) -> Any: ...
\r
173 user_agent = ... # type: str
\r
174 accept_gzip_encoding = ... # type: bool
\r
175 encode_threshold = ... # type: Optional[int]
\r
176 def __init__(self, use_datetime: bool = ...) -> None: ...
\r
177 def request(self, host: _hostDesc, handler: str, request_body: str, verbose: bool = ...) -> tuple: ...
\r
178 verbose = ... # type: bool
\r
179 def single_request(self, host: _hostDesc, handler: str, request_body: str, verbose: bool = ...) -> tuple: ...
\r
180 def getparser(self) -> Tuple[Union[ExpatParser, SlowParser], Unmarshaller]: ...
\r
181 def get_host_info(self, host: _hostDesc) -> Tuple[str, Optional[List[Tuple[str, str]]], Optional[Mapping[Any, Any]]]: ...
\r
182 def make_connection(self, host: _hostDesc) -> HTTPConnection: ...
\r
183 def close(self) -> None: ...
\r
184 def send_request(self, connection: HTTPConnection, handler: str, request_body: str) -> None: ...
\r
185 def send_host(self, connection: HTTPConnection, host: str) -> None: ...
\r
186 def send_user_agent(self, connection: HTTPConnection) -> None: ...
\r
187 def send_content(self, connection: HTTPConnection, request_body: str) -> None: ...
\r
188 def parse_response(self, response: HTTPResponse) -> tuple: ...
\r
190 class SafeTransport(Transport):
\r
191 def __init__(self, use_datetime: bool = ..., context: Optional[SSLContext] = ...) -> None: ...
\r
192 def make_connection(self, host: _hostDesc) -> HTTPSConnection: ...
\r
195 def __init__(self, uri: str, transport: Optional[Transport] = ..., encoding: Optional[str] = ..., verbose: bool = ..., allow_none: bool = ..., use_datetime: bool = ..., context: Optional[SSLContext] = ...) -> None: ...
\r
196 def __getattr__(self, name: str) -> _Method: ...
\r
197 def __call__(self, attr: str) -> Optional[Transport]: ...
\r
199 Server = ServerProxy
\r