massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-pyright / node_modules / pyright / dist / typeshed-fallback / stdlib / xmlrpc / server.pyi
1 import http.server
2 import pydoc
3 import socketserver
4 import sys
5 from datetime import datetime
6 from typing import Any, Callable, Dict, Iterable, List, Mapping, Pattern, Protocol, Tuple, Type, Union
7 from xmlrpc.client import Fault
8
9 # TODO: Recursive type on tuple, list, dict
10 _Marshallable = Union[None, bool, int, float, str, bytes, Tuple[Any, ...], List[Any], Dict[Any, Any], datetime]
11
12 # The dispatch accepts anywhere from 0 to N arguments, no easy way to allow this in mypy
13 class _DispatchArity0(Protocol):
14     def __call__(self) -> _Marshallable: ...
15
16 class _DispatchArity1(Protocol):
17     def __call__(self, __arg1: _Marshallable) -> _Marshallable: ...
18
19 class _DispatchArity2(Protocol):
20     def __call__(self, __arg1: _Marshallable, __arg2: _Marshallable) -> _Marshallable: ...
21
22 class _DispatchArity3(Protocol):
23     def __call__(self, __arg1: _Marshallable, __arg2: _Marshallable, __arg3: _Marshallable) -> _Marshallable: ...
24
25 class _DispatchArity4(Protocol):
26     def __call__(
27         self, __arg1: _Marshallable, __arg2: _Marshallable, __arg3: _Marshallable, __arg4: _Marshallable
28     ) -> _Marshallable: ...
29
30 class _DispatchArityN(Protocol):
31     def __call__(self, *args: _Marshallable) -> _Marshallable: ...
32
33 _DispatchProtocol = Union[_DispatchArity0, _DispatchArity1, _DispatchArity2, _DispatchArity3, _DispatchArity4, _DispatchArityN]
34
35 def resolve_dotted_attribute(obj: Any, attr: str, allow_dotted_names: bool = ...) -> Any: ...  # undocumented
36 def list_public_methods(obj: Any) -> list[str]: ...  # undocumented
37
38 class SimpleXMLRPCDispatcher:  # undocumented
39
40     funcs: dict[str, _DispatchProtocol]
41     instance: Any | None
42     allow_none: bool
43     encoding: str
44     use_builtin_types: bool
45     def __init__(self, allow_none: bool = ..., encoding: str | None = ..., use_builtin_types: bool = ...) -> None: ...
46     def register_instance(self, instance: Any, allow_dotted_names: bool = ...) -> None: ...
47     if sys.version_info >= (3, 7):
48         def register_function(self, function: _DispatchProtocol | None = ..., name: str | None = ...) -> Callable[..., Any]: ...
49     else:
50         def register_function(self, function: _DispatchProtocol, name: str | None = ...) -> Callable[..., Any]: ...
51     def register_introspection_functions(self) -> None: ...
52     def register_multicall_functions(self) -> None: ...
53     def _marshaled_dispatch(
54         self,
55         data: str,
56         dispatch_method: Callable[[str | None, Tuple[_Marshallable, ...]], Fault | Tuple[_Marshallable, ...]] | None = ...,
57         path: Any | None = ...,
58     ) -> str: ...  # undocumented
59     def system_listMethods(self) -> list[str]: ...  # undocumented
60     def system_methodSignature(self, method_name: str) -> str: ...  # undocumented
61     def system_methodHelp(self, method_name: str) -> str: ...  # undocumented
62     def system_multicall(self, call_list: list[dict[str, _Marshallable]]) -> list[_Marshallable]: ...  # undocumented
63     def _dispatch(self, method: str, params: Iterable[_Marshallable]) -> _Marshallable: ...  # undocumented
64
65 class SimpleXMLRPCRequestHandler(http.server.BaseHTTPRequestHandler):
66
67     rpc_paths: tuple[str, str]
68     encode_threshold: int  # undocumented
69     aepattern: Pattern[str]  # undocumented
70     def accept_encodings(self) -> dict[str, float]: ...
71     def is_rpc_path_valid(self) -> bool: ...
72     def do_POST(self) -> None: ...
73     def decode_request_content(self, data: bytes) -> bytes | None: ...
74     def report_404(self) -> None: ...
75     def log_request(self, code: int | str = ..., size: int | str = ...) -> None: ...
76
77 class SimpleXMLRPCServer(socketserver.TCPServer, SimpleXMLRPCDispatcher):
78
79     allow_reuse_address: bool
80     _send_traceback_handler: bool
81     def __init__(
82         self,
83         addr: tuple[str, int],
84         requestHandler: Type[SimpleXMLRPCRequestHandler] = ...,
85         logRequests: bool = ...,
86         allow_none: bool = ...,
87         encoding: str | None = ...,
88         bind_and_activate: bool = ...,
89         use_builtin_types: bool = ...,
90     ) -> None: ...
91
92 class MultiPathXMLRPCServer(SimpleXMLRPCServer):  # undocumented
93
94     dispatchers: dict[str, SimpleXMLRPCDispatcher]
95     allow_none: bool
96     encoding: str
97     def __init__(
98         self,
99         addr: tuple[str, int],
100         requestHandler: Type[SimpleXMLRPCRequestHandler] = ...,
101         logRequests: bool = ...,
102         allow_none: bool = ...,
103         encoding: str | None = ...,
104         bind_and_activate: bool = ...,
105         use_builtin_types: bool = ...,
106     ) -> None: ...
107     def add_dispatcher(self, path: str, dispatcher: SimpleXMLRPCDispatcher) -> SimpleXMLRPCDispatcher: ...
108     def get_dispatcher(self, path: str) -> SimpleXMLRPCDispatcher: ...
109     def _marshaled_dispatch(
110         self,
111         data: str,
112         dispatch_method: Callable[[str | None, Tuple[_Marshallable, ...]], Fault | Tuple[_Marshallable, ...]] | None = ...,
113         path: Any | None = ...,
114     ) -> str: ...
115
116 class CGIXMLRPCRequestHandler(SimpleXMLRPCDispatcher):
117     def __init__(self, allow_none: bool = ..., encoding: str | None = ..., use_builtin_types: bool = ...) -> None: ...
118     def handle_xmlrpc(self, request_text: str) -> None: ...
119     def handle_get(self) -> None: ...
120     def handle_request(self, request_text: str | None = ...) -> None: ...
121
122 class ServerHTMLDoc(pydoc.HTMLDoc):  # undocumented
123     def docroutine(self, object: object, name: str, mod: str | None = ..., funcs: Mapping[str, str] = ..., classes: Mapping[str, str] = ..., methods: Mapping[str, str] = ..., cl: type | None = ...) -> str: ...  # type: ignore
124     def docserver(self, server_name: str, package_documentation: str, methods: dict[str, str]) -> str: ...
125
126 class XMLRPCDocGenerator:  # undocumented
127
128     server_name: str
129     server_documentation: str
130     server_title: str
131     def __init__(self) -> None: ...
132     def set_server_title(self, server_title: str) -> None: ...
133     def set_server_name(self, server_name: str) -> None: ...
134     def set_server_documentation(self, server_documentation: str) -> None: ...
135     def generate_html_documentation(self) -> str: ...
136
137 class DocXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
138     def do_GET(self) -> None: ...
139
140 class DocXMLRPCServer(SimpleXMLRPCServer, XMLRPCDocGenerator):
141     def __init__(
142         self,
143         addr: tuple[str, int],
144         requestHandler: Type[SimpleXMLRPCRequestHandler] = ...,
145         logRequests: bool = ...,
146         allow_none: bool = ...,
147         encoding: str | None = ...,
148         bind_and_activate: bool = ...,
149         use_builtin_types: bool = ...,
150     ) -> None: ...
151
152 class DocCGIXMLRPCRequestHandler(CGIXMLRPCRequestHandler, XMLRPCDocGenerator):
153     def __init__(self) -> None: ...