diff --git a/stdlib/3/xml/etree/ElementInclude.pyi b/stdlib/3/xml/etree/ElementInclude.pyi index a9e04f256..11198ceeb 100644 --- a/stdlib/3/xml/etree/ElementInclude.pyi +++ b/stdlib/3/xml/etree/ElementInclude.pyi @@ -3,7 +3,7 @@ # NOTE: This dynamically typed stub was automatically generated by stubgen. from typing import Union, Optional, Callable -from .ElementTree import Element +from .ElementTree import _ElementInterface XINCLUDE = ... # type: str XINCLUDE_INCLUDE = ... # type: str @@ -11,9 +11,9 @@ XINCLUDE_FALLBACK = ... # type: str class FatalIncludeError(SyntaxError): ... -def default_loader(href: Union[str, bytes, int], parse: str, encoding: Optional[str]=...) -> Union[str, Element]: ... +def default_loader(href: Union[str, bytes, int], parse: str, encoding: Optional[str]=...) -> Union[str, _ElementInterface]: ... # TODO: loader is of type default_loader ie it takes a callable that has the # same signature as default_loader. But default_loader has a keyword argument # Which can't be represented using Callable... -def include(elem: Element, loader: Callable[..., Union[str, Element]]=...) -> None: ... +def include(elem: _ElementInterface, loader: Callable[..., Union[str, _ElementInterface]]=...) -> None: ... diff --git a/stdlib/3/xml/etree/ElementPath.pyi b/stdlib/3/xml/etree/ElementPath.pyi index bb5c90b6a..e0cb256ce 100644 --- a/stdlib/3/xml/etree/ElementPath.pyi +++ b/stdlib/3/xml/etree/ElementPath.pyi @@ -20,6 +20,6 @@ class Path: def find(element: _ElementInterface, path: str) -> Optional[_ElementInterface]: ... -def findtext(element: Element, path: str, default: _T=...) -> Union[str, _T]: ... +def findtext(element: _ElementInterface, path: str, default: _T=...) -> Union[str, _T]: ... def findall(element: _ElementInterface, path: str) -> List[_ElementInterface]: ... diff --git a/stdlib/3/xml/etree/ElementTree.pyi b/stdlib/3/xml/etree/ElementTree.pyi index 4c60663e8..b443fbe35 100644 --- a/stdlib/3/xml/etree/ElementTree.pyi +++ b/stdlib/3/xml/etree/ElementTree.pyi @@ -16,7 +16,7 @@ class _ElementInterface: attrib = ... # type: Dict[_str_or_bytes, _str_or_bytes] text = ... # type: Optional[_str_or_bytes] tail = ... # type: Optional[_str_or_bytes] - def __init__(self, tag: Union[AnyStr, Callable[..., Element]], attrib: Dict[AnyStr, AnyStr]) -> None: ... + def __init__(self, tag: Union[AnyStr, Callable[..., _ElementInterface]], attrib: Dict[AnyStr, AnyStr]) -> None: ... def makeelement(self, tag: _Ss, attrib: Dict[_Ss, _Ss]) -> _ElementInterface: ... def __len__(self) -> int: ... def __getitem__(self, index: int) -> _ElementInterface: ... @@ -25,7 +25,7 @@ class _ElementInterface: def __getslice__(self, start: int, stop: int) -> Sequence[_ElementInterface]: ... def __setslice__(self, start: int, stop: int, elements: Sequence[_ElementInterface]) -> None: ... def __delslice__(self, start: int, stop: int) -> None: ... - def append(self, element: Element) -> None: ... + def append(self, element: _ElementInterface) -> None: ... def insert(self, index: int, element: _ElementInterface) -> None: ... def remove(self, element: _ElementInterface) -> None: ... def getchildren(self) -> List[_ElementInterface]: ... @@ -39,7 +39,7 @@ class _ElementInterface: def items(self) -> ItemsView[AnyStr, AnyStr]: ... def getiterator(self, tag: Union[str, AnyStr]=...) -> List[_ElementInterface]: ... -def Element(tag: Union[AnyStr, Callable[..., Element]], attrib: Dict[AnyStr, AnyStr]=..., **extra: Dict[str, AnyStr]) -> _ElementInterface: ... +def Element(tag: Union[AnyStr, Callable[..., _ElementInterface]], attrib: Dict[AnyStr, AnyStr]=..., **extra: Dict[str, AnyStr]) -> _ElementInterface: ... def SubElement(parent: _ElementInterface, tag: AnyStr, attrib: Dict[AnyStr, AnyStr]=..., **extra: Dict[str, AnyStr]) -> _ElementInterface: ... def Comment(text: _str_or_bytes=...) -> _ElementInterface: ... def ProcessingInstruction(target: str, text: str=...) -> _ElementInterface: ... @@ -89,7 +89,7 @@ class TreeBuilder: def start(self, tag: AnyStr, attrs: Dict[AnyStr, AnyStr]) -> _ElementInterface: ... def end(self, tag: AnyStr) -> _ElementInterface: ... -class XMLParser: +class XMLTreeBuilder: # TODO-what is entity used for??? entity = ... # type: Any def __init__(self, html: int=..., target: TreeBuilder=...) -> None: ...