mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 13:04:46 +08:00
Add missing objects to xml.etree.ElementTree (#6540)
Co-authored-by: Akuli <akuviljanen17@gmail.com>
This commit is contained in:
@@ -10,6 +10,7 @@ from typing import (
|
||||
Iterable,
|
||||
Iterator,
|
||||
KeysView,
|
||||
Mapping,
|
||||
MutableSequence,
|
||||
Sequence,
|
||||
TypeVar,
|
||||
@@ -259,11 +260,29 @@ def fromstringlist(sequence: Sequence[str | bytes], parser: XMLParser | None = .
|
||||
_ElementFactory = Callable[[Any, Dict[Any, Any]], Element]
|
||||
|
||||
class TreeBuilder:
|
||||
def __init__(self, element_factory: _ElementFactory | None = ...) -> None: ...
|
||||
if sys.version_info >= (3, 8):
|
||||
# comment_factory can take None because passing None to Comment is not an error
|
||||
def __init__(
|
||||
self,
|
||||
element_factory: _ElementFactory | None = ...,
|
||||
*,
|
||||
comment_factory: Callable[[str | None], Element] | None = ...,
|
||||
pi_factory: Callable[[str, str | None], Element] | None = ...,
|
||||
insert_comments: bool = ...,
|
||||
insert_pis: bool = ...,
|
||||
) -> None: ...
|
||||
insert_comments: bool
|
||||
insert_pis: bool
|
||||
else:
|
||||
def __init__(self, element_factory: _ElementFactory | None = ...) -> None: ...
|
||||
def close(self) -> Element: ...
|
||||
def data(self, __data: str | bytes) -> None: ...
|
||||
def start(self, __tag: str | bytes, __attrs: dict[str | bytes, str | bytes]) -> Element: ...
|
||||
def end(self, __tag: str | bytes) -> Element: ...
|
||||
if sys.version_info >= (3, 8):
|
||||
# These two methods have pos-only parameters in the C implementation
|
||||
def comment(self, __text: str | None) -> Element: ...
|
||||
def pi(self, __target: str, __text: str | None = ...) -> Element: ...
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
class C14NWriterTarget:
|
||||
@@ -279,6 +298,12 @@ if sys.version_info >= (3, 8):
|
||||
exclude_attrs: Iterable[str] | None = ...,
|
||||
exclude_tags: Iterable[str] | None = ...,
|
||||
) -> None: ...
|
||||
def data(self, data: str) -> None: ...
|
||||
def start_ns(self, prefix: str, uri: str) -> None: ...
|
||||
def start(self, tag: str, attrs: Mapping[str, str]) -> None: ...
|
||||
def end(self, tag: str) -> None: ...
|
||||
def comment(self, text: str) -> None: ...
|
||||
def pi(self, target: str, data: str) -> None: ...
|
||||
|
||||
class XMLParser:
|
||||
parser: Any
|
||||
|
||||
Reference in New Issue
Block a user