massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / coc-python-data / languageServer.0.5.59 / Typeshed / stdlib / 2and3 / xml / etree / ElementTree.pyi
diff --git a/.config/coc/extensions/coc-python-data/languageServer.0.5.59/Typeshed/stdlib/2and3/xml/etree/ElementTree.pyi b/.config/coc/extensions/coc-python-data/languageServer.0.5.59/Typeshed/stdlib/2and3/xml/etree/ElementTree.pyi
new file mode 100644 (file)
index 0000000..9fd72d9
--- /dev/null
@@ -0,0 +1,167 @@
+# Stubs for xml.etree.ElementTree\r
+\r
+from typing import Any, Callable, Dict, Generator, IO, ItemsView, Iterable, Iterator, KeysView, List, MutableSequence, Optional, overload, Sequence, Text, Tuple, TypeVar, Union\r
+import io\r
+import sys\r
+\r
+VERSION = ...  # type: str\r
+\r
+class ParseError(SyntaxError): ...\r
+\r
+def iselement(element: 'Element') -> bool: ...\r
+\r
+_T = TypeVar('_T')\r
+\r
+# Type for parser inputs. Parser will accept any unicode/str/bytes and coerce,\r
+# and this is true in py2 and py3 (even fromstringlist() in python3 can be\r
+# called with a heterogeneous list)\r
+_parser_input_type = Union[bytes, Text]\r
+\r
+# Type for individual tag/attr/ns/text values in args to most functions.\r
+# In py2, the library accepts str or unicode everywhere and coerces\r
+# aggressively.\r
+# In py3, bytes is not coerced to str and so use of bytes is probably an error,\r
+# so we exclude it. (why? the parser never produces bytes when it parses XML,\r
+# so e.g., element.get(b'name') will always return None for parsed XML, even if\r
+# there is a 'name' attribute.)\r
+_str_argument_type = Union[str, Text]\r
+\r
+# Type for return values from individual tag/attr/text values and serialization\r
+if sys.version_info >= (3,):\r
+    # note: in python3, everything comes out as str, yay:\r
+    _str_result_type = str\r
+    # unfortunately, tostring and tostringlist can return either bytes or str\r
+    # depending on the value of `encoding` parameter. Client code knows best:\r
+    _tostring_result_type = Any\r
+else:\r
+    # in python2, if the tag/attribute/text wasn't decode-able as ascii, it\r
+    # comes out as a unicode string; otherwise it comes out as str. (see\r
+    # _fixtext function in the source). Client code knows best:\r
+    _str_result_type = Any\r
+    # On the bright side, tostring and tostringlist always return bytes:\r
+    _tostring_result_type = bytes\r
+\r
+class Element(MutableSequence['Element']):\r
+    tag = ...  # type: _str_result_type\r
+    attrib = ...  # type: Dict[_str_result_type, _str_result_type]\r
+    text = ...  # type: Optional[_str_result_type]\r
+    tail = ...  # type: Optional[_str_result_type]\r
+    def __init__(self, tag: Union[_str_argument_type, Callable[..., 'Element']], attrib: Dict[_str_argument_type, _str_argument_type]=..., **extra: _str_argument_type) -> None: ...\r
+    def append(self, subelement: 'Element') -> None: ...\r
+    def clear(self) -> None: ...\r
+    def copy(self) -> 'Element': ...\r
+    def extend(self, elements: Iterable['Element']) -> None: ...\r
+    def find(self, path: _str_argument_type, namespaces: Dict[_str_argument_type, _str_argument_type]=...) -> Optional['Element']: ...\r
+    def findall(self, path: _str_argument_type, namespaces: Dict[_str_argument_type, _str_argument_type]=...) -> List['Element']: ...\r
+    def findtext(self, path: _str_argument_type, default: _T=..., namespaces: Dict[_str_argument_type, _str_argument_type]=...) -> Union[_T, _str_result_type]: ...\r
+    def get(self, key: _str_argument_type, default: _T=...) -> Union[_str_result_type, _T]: ...\r
+    def getchildren(self) -> List['Element']: ...\r
+    def getiterator(self, tag: _str_argument_type=...) -> List['Element']: ...\r
+    if sys.version_info >= (3, 2):\r
+        def insert(self, index: int, subelement: 'Element') -> None: ...\r
+    else:\r
+        def insert(self, index: int, element: 'Element') -> None: ...\r
+    def items(self) -> ItemsView[_str_result_type, _str_result_type]: ...\r
+    def iter(self, tag: _str_argument_type=...) -> Generator['Element', None, None]: ...\r
+    def iterfind(self, path: _str_argument_type, namespaces: Dict[_str_argument_type, _str_argument_type]=...) -> List['Element']: ...\r
+    def itertext(self) -> Generator[_str_result_type, None, None]: ...\r
+    def keys(self) -> KeysView[_str_result_type]: ...\r
+    def makeelement(self, tag: _str_argument_type, attrib: Dict[_str_argument_type, _str_argument_type]) -> 'Element': ...\r
+    def remove(self, subelement: 'Element') -> None: ...\r
+    def set(self, key: _str_argument_type, value: _str_argument_type) -> None: ...\r
+    def __bool__(self) -> bool: ...\r
+    def __delitem__(self, i: Union[int, slice]) -> None: ...\r
+    @overload\r
+    def __getitem__(self, i: int) -> 'Element': ...\r
+    @overload\r
+    def __getitem__(self, s: slice) -> Sequence['Element']: ...\r
+    def __len__(self) -> int: ...\r
+    @overload\r
+    def __setitem__(self, i: int, o: 'Element') -> None: ...\r
+    @overload\r
+    def __setitem__(self, s: slice, o: Iterable['Element']) -> None: ...\r
+\r
+\r
+def SubElement(parent: Element, tag: _str_argument_type, attrib: Dict[_str_argument_type, _str_argument_type]=..., **extra: _str_argument_type) -> Element: ...\r
+def Comment(text: _str_argument_type=...) -> Element: ...\r
+def ProcessingInstruction(target: _str_argument_type, text: _str_argument_type=...) -> Element: ...\r
+\r
+PI = ...  # type: Callable[..., Element]\r
+\r
+class QName:\r
+    text = ...  # type: str\r
+    def __init__(self, text_or_uri: _str_argument_type, tag: _str_argument_type=...) -> None: ...\r
+\r
+\r
+_file_or_filename = Union[str, bytes, int, IO[Any]]\r
+\r
+class ElementTree:\r
+    def __init__(self, element: Element=..., file: _file_or_filename=...) -> None: ...\r
+    def getroot(self) -> Element: ...\r
+    def parse(self, source: _file_or_filename, parser: 'XMLParser'=...) -> Element: ...\r
+    def iter(self, tag: _str_argument_type=...) -> Generator[Element, None, None]: ...\r
+    def getiterator(self, tag: _str_argument_type=...) -> List[Element]: ...\r
+    def find(self, path: _str_argument_type, namespaces: Dict[_str_argument_type, _str_argument_type]=...) -> Optional[Element]: ...\r
+    def findtext(self, path: _str_argument_type, default: _T=..., namespaces: Dict[_str_argument_type, _str_argument_type]=...) -> Union[_T, _str_result_type]: ...\r
+    def findall(self, path: _str_argument_type, namespaces: Dict[_str_argument_type, _str_argument_type]=...) -> List[Element]: ...\r
+    def iterfind(self, path: _str_argument_type, namespaces: Dict[_str_argument_type, _str_argument_type]=...) -> List[Element]: ...\r
+    if sys.version_info >= (3, 4):\r
+        def write(self, file_or_filename: _file_or_filename, encoding: str=..., xml_declaration: Optional[bool]=..., default_namespace: _str_argument_type=..., method: str=..., *, short_empty_elements: bool=...) -> None: ...\r
+    else:\r
+        def write(self, file_or_filename: _file_or_filename, encoding: str=..., xml_declaration: Optional[bool]=..., default_namespace: _str_argument_type=..., method: str=...) -> None: ...\r
+    def write_c14n(self, file: _file_or_filename) -> None: ...\r
+\r
+def register_namespace(prefix: _str_argument_type, uri: _str_argument_type) -> None: ...\r
+if sys.version_info >= (3, 4):\r
+    def tostring(element: Element, encoding: str=..., method: str=..., *, short_empty_elements: bool=...) -> _tostring_result_type: ...\r
+    def tostringlist(element: Element, encoding: str=..., method: str=..., *, short_empty_elements: bool=...) -> List[_tostring_result_type]: ...\r
+else:\r
+    def tostring(element: Element, encoding: str=..., method: str=...) -> _tostring_result_type: ...\r
+    def tostringlist(element: Element, encoding: str=..., method: str=...) -> List[_tostring_result_type]: ...\r
+def dump(elem: Element) -> None: ...\r
+def parse(source: _file_or_filename, parser: 'XMLParser'=...) -> ElementTree: ...\r
+def iterparse(source: _file_or_filename, events: Sequence[str]=..., parser: 'XMLParser'=...) -> Iterator[Tuple[str, Any]]: ...\r
+\r
+if sys.version_info >= (3, 4):\r
+    class XMLPullParser:\r
+        def __init__(self, events: Sequence[str]=..., *, _parser: 'XMLParser'=...) -> None: ...\r
+        def feed(self, data: bytes) -> None: ...\r
+        def close(self) -> None: ...\r
+        def read_events(self) -> Iterator[Tuple[str, Element]]: ...\r
+\r
+def XML(text: _parser_input_type, parser: 'XMLParser'=...) -> Element: ...\r
+def XMLID(text: _parser_input_type, parser: 'XMLParser'=...) -> Tuple[Element, Dict[_str_result_type, Element]]: ...\r
+\r
+# This is aliased to XML in the source.\r
+fromstring = XML\r
+\r
+def fromstringlist(sequence: Sequence[_parser_input_type], parser: 'XMLParser'=...) -> Element: ...\r
+\r
+# This type is both not precise enough and too precise. The TreeBuilder\r
+# requires the elementfactory to accept tag and attrs in its args and produce\r
+# some kind of object that has .text and .tail properties.\r
+# I've chosen to constrain the ElementFactory to always produce an Element\r
+# because that is how almost everyone will use it.\r
+# Unfortunately, the type of the factory arguments is dependent on how\r
+# TreeBuilder is called by client code (they could pass strs, bytes or whatever);\r
+# but we don't want to use a too-broad type, or it would be too hard to write\r
+# elementfactories.\r
+_ElementFactory = Callable[[Any, Dict[Any, Any]], Element]\r
+\r
+class TreeBuilder:\r
+    def __init__(self, element_factory: _ElementFactory=...) -> None: ...\r
+    def close(self) -> Element: ...\r
+    def data(self, data: _parser_input_type) -> None: ...\r
+    def start(self, tag: _parser_input_type, attrs: Dict[_parser_input_type, _parser_input_type]) -> Element: ...\r
+    def end(self, tag: _parser_input_type) -> Element: ...\r
+\r
+class XMLParser:\r
+    parser = ...  # type: Any\r
+    target = ...  # type: TreeBuilder\r
+    # TODO-what is entity used for???\r
+    entity = ...  # type: Any\r
+    version = ...  # type: str\r
+    def __init__(self, html: int=..., target: TreeBuilder=..., encoding: str=...) -> None: ...\r
+    def doctype(self, name: str, pubid: str, system: str) -> None: ...\r
+    def close(self) -> Element: ...\r
+    def feed(self, data: _parser_input_type) -> None: ...\r