|
| 1 | +import xml.etree.ElementTree as ET |
| 2 | +from _typeshed import Unused |
| 3 | +from collections.abc import Callable |
| 4 | +from typing import Any, Literal, overload |
| 5 | + |
| 6 | +def current_global_nsmap() -> dict[str, str]: ... |
| 7 | + |
| 8 | +class IncrementalTree(ET.ElementTree): |
| 9 | + def write( # type: ignore[override] |
| 10 | + self, |
| 11 | + file_or_filename: ET._FileWrite, |
| 12 | + encoding: str | None = None, |
| 13 | + xml_declaration: bool | None = None, |
| 14 | + default_namespace: str | None = None, |
| 15 | + method: Literal["xml", "html", "text"] | None = None, # does not accept 'c14n', unlike parent method |
| 16 | + *, |
| 17 | + short_empty_elements: bool = True, |
| 18 | + nsmap: dict[str, str] | None = None, |
| 19 | + root_ns_only: bool = False, |
| 20 | + minimal_ns_only: bool = False, |
| 21 | + ) -> None: ... |
| 22 | + |
| 23 | +def process_attribs( |
| 24 | + elem: ET.Element[Any], |
| 25 | + is_nsmap_scope_changed: bool | None, |
| 26 | + default_ns_attr_prefix: str | None, |
| 27 | + nsmap_scope: dict[str, str], |
| 28 | + global_nsmap: dict[str, str], |
| 29 | + new_namespace_prefixes: set[str], |
| 30 | + uri_to_prefix: dict[str, str], |
| 31 | +) -> tuple[list[tuple[str, str]], str | None, dict[str, str]]: ... |
| 32 | +def write_elem_start( |
| 33 | + write: Callable[..., None], |
| 34 | + elem: ET.Element[Any], |
| 35 | + nsmap_scope: dict[str, str], |
| 36 | + global_nsmap: dict[str, str], |
| 37 | + short_empty_elements: bool | None, |
| 38 | + is_html: bool | None, |
| 39 | + is_root: bool = False, |
| 40 | + uri_to_prefix: dict[str, str] | None = None, |
| 41 | + default_ns_attr_prefix: str | None = None, |
| 42 | + new_nsmap: dict[str, str] | None = None, |
| 43 | + **kwargs: Unused, |
| 44 | +) -> tuple[str | None, dict[str, str], str | None, dict[str, str] | None, bool]: ... |
| 45 | +@overload |
| 46 | +def tostring( |
| 47 | + element: ET.Element[Any], |
| 48 | + encoding: None = None, |
| 49 | + method: Literal["xml", "html", "text"] | None = None, |
| 50 | + *, |
| 51 | + xml_declaration: bool | None = None, |
| 52 | + default_namespace: str | None = None, |
| 53 | + short_empty_elements: bool = True, |
| 54 | + nsmap: dict[str, str] | None = None, |
| 55 | + root_ns_only: bool = False, |
| 56 | + minimal_ns_only: bool = False, |
| 57 | + tree_cls: type[ET.ElementTree] = ..., |
| 58 | +) -> bytes: ... |
| 59 | +@overload |
| 60 | +def tostring( |
| 61 | + element: ET.Element[Any], |
| 62 | + encoding: Literal["unicode"], |
| 63 | + method: Literal["xml", "html", "text"] | None = None, |
| 64 | + *, |
| 65 | + xml_declaration: bool | None = None, |
| 66 | + default_namespace: str | None = None, |
| 67 | + short_empty_elements: bool = True, |
| 68 | + nsmap: dict[str, str] | None = None, |
| 69 | + root_ns_only: bool = False, |
| 70 | + minimal_ns_only: bool = False, |
| 71 | + tree_cls: type[ET.ElementTree] = ..., |
| 72 | +) -> str: ... |
| 73 | +@overload |
| 74 | +def tostring( |
| 75 | + element: ET.Element[Any], |
| 76 | + encoding: str, |
| 77 | + method: Literal["xml", "html", "text"] | None = None, |
| 78 | + *, |
| 79 | + xml_declaration: bool | None = None, |
| 80 | + default_namespace: str | None = None, |
| 81 | + short_empty_elements: bool = True, |
| 82 | + nsmap: dict[str, str] | None = None, |
| 83 | + root_ns_only: bool = False, |
| 84 | + minimal_ns_only: bool = False, |
| 85 | + tree_cls: type[ET.ElementTree] = ..., |
| 86 | +) -> Any: ... |
| 87 | +@overload |
| 88 | +def tostringlist( |
| 89 | + element: ET.Element[Any], |
| 90 | + encoding: None = None, |
| 91 | + method: Literal["xml", "html", "text"] | None = None, |
| 92 | + *, |
| 93 | + xml_declaration: bool | None = None, |
| 94 | + default_namespace: str | None = None, |
| 95 | + short_empty_elements: bool = True, |
| 96 | + nsmap: dict[str, str] | None = None, |
| 97 | + root_ns_only: bool = False, |
| 98 | + minimal_ns_only: bool = False, |
| 99 | + tree_cls: type[ET.ElementTree] = ..., |
| 100 | +) -> list[bytes]: ... |
| 101 | +@overload |
| 102 | +def tostringlist( |
| 103 | + element: ET.Element[Any], |
| 104 | + encoding: Literal["unicode"], |
| 105 | + method: Literal["xml", "html", "text"] | None = None, |
| 106 | + *, |
| 107 | + xml_declaration: bool | None = None, |
| 108 | + default_namespace: str | None = None, |
| 109 | + short_empty_elements: bool = True, |
| 110 | + nsmap: dict[str, str] | None = None, |
| 111 | + root_ns_only: bool = False, |
| 112 | + minimal_ns_only: bool = False, |
| 113 | + tree_cls: type[ET.ElementTree] = ..., |
| 114 | +) -> list[str]: ... |
| 115 | +@overload |
| 116 | +def tostringlist( |
| 117 | + element: ET.Element[Any], |
| 118 | + encoding: str, |
| 119 | + method: Literal["xml", "html", "text"] | None = None, |
| 120 | + *, |
| 121 | + xml_declaration: bool | None = None, |
| 122 | + default_namespace: str | None = None, |
| 123 | + short_empty_elements: bool = True, |
| 124 | + nsmap: dict[str, str] | None = None, |
| 125 | + root_ns_only: bool = False, |
| 126 | + minimal_ns_only: bool = False, |
| 127 | + tree_cls: type[ET.ElementTree] = ..., |
| 128 | +) -> list[Any]: ... |
| 129 | +@overload |
| 130 | +def compat_tostring( |
| 131 | + element: ET.Element[Any], |
| 132 | + encoding: None = None, |
| 133 | + method: Literal["xml", "html", "text"] | None = None, |
| 134 | + *, |
| 135 | + xml_declaration: bool | None = None, |
| 136 | + default_namespace: str | None = None, |
| 137 | + short_empty_elements: bool = True, |
| 138 | + nsmap: dict[str, str] | None = None, |
| 139 | + root_ns_only: bool = True, |
| 140 | + minimal_ns_only: bool = False, |
| 141 | + tree_cls: type[ET.ElementTree] = ..., |
| 142 | +) -> bytes: ... |
| 143 | +@overload |
| 144 | +def compat_tostring( |
| 145 | + element: ET.Element[Any], |
| 146 | + encoding: Literal["unicode"], |
| 147 | + method: Literal["xml", "html", "text"] | None = None, |
| 148 | + *, |
| 149 | + xml_declaration: bool | None = None, |
| 150 | + default_namespace: str | None = None, |
| 151 | + short_empty_elements: bool = True, |
| 152 | + nsmap: dict[str, str] | None = None, |
| 153 | + root_ns_only: bool = True, |
| 154 | + minimal_ns_only: bool = False, |
| 155 | + tree_cls: type[ET.ElementTree] = ..., |
| 156 | +) -> str: ... |
| 157 | +@overload |
| 158 | +def compat_tostring( |
| 159 | + element: ET.Element[Any], |
| 160 | + encoding: str, |
| 161 | + method: Literal["xml", "html", "text"] | None = None, |
| 162 | + *, |
| 163 | + xml_declaration: bool | None = None, |
| 164 | + default_namespace: str | None = None, |
| 165 | + short_empty_elements: bool = True, |
| 166 | + nsmap: dict[str, str] | None = None, |
| 167 | + root_ns_only: bool = True, |
| 168 | + minimal_ns_only: bool = False, |
| 169 | + tree_cls: type[ET.ElementTree] = ..., |
| 170 | +) -> Any: ... |
0 commit comments