xml.etree.ElementTree: fix missing None in get(), findtext() return type (#3093)

This commit is contained in:
Ran Benita authored and Sebastian Rittau committed 2019-07-01 14:28:40 +02:00
1 parent 8b66e08745
commit c66699800e
1 file changed
+13 -4
+13 -4
View File
@@ -1,6 +1,6 @@
# Stubs for xml.etree.ElementTree
from typing import Any, Callable, Dict, Generator, IO, ItemsView, Iterable, Iterator, KeysView, List, MutableSequence, Optional, overload, Sequence, Text, Tuple, TypeVar, Union
from typing import Any, Callable, Dict, Generator, IO, ItemsView, Iterable, Iterator, KeysView, List, MutableSequence, Optional, overload, Sequence, Text, Tuple, TypeVar, Union, overload
import io
import sys
@@ -53,8 +53,14 @@ class Element(MutableSequence[Element]):
def extend(self, elements: Iterable[Element]) -> None: ...
def find(self, path: _str_argument_type, namespaces: Optional[Dict[_str_argument_type, _str_argument_type]] = ...) -> Optional[Element]: ...
def findall(self, path: _str_argument_type, namespaces: Optional[Dict[_str_argument_type, _str_argument_type]] = ...) -> List[Element]: ...
def findtext(self, path: _str_argument_type, default: Optional[_T] = ..., namespaces: Optional[Dict[_str_argument_type, _str_argument_type]] = ...) -> Union[_T, _str_result_type]: ...
def get(self, key: _str_argument_type, default: Optional[_T] = ...) -> Union[_str_result_type, _T]: ...
@overload
def findtext(self, path: _str_argument_type, *, namespaces: Optional[Dict[_str_argument_type, _str_argument_type]] = ...) -> Optional[_str_result_type]: ...
@overload
def findtext(self, path: _str_argument_type, default: _T, namespaces: Optional[Dict[_str_argument_type, _str_argument_type]] = ...) -> Union[_T, _str_result_type]: ...
@overload
def get(self, key: _str_argument_type) -> Optional[_str_result_type]: ...
@overload
def get(self, key: _str_argument_type, default: _T) -> Union[_str_result_type, _T]: ...
def getchildren(self) -> List[Element]: ...
def getiterator(self, tag: Optional[_str_argument_type] = ...) -> List[Element]: ...
if sys.version_info >= (3, 2):
@@ -102,7 +108,10 @@ class ElementTree:
def iter(self, tag: Optional[_str_argument_type] = ...) -> Generator[Element, None, None]: ...
def getiterator(self, tag: Optional[_str_argument_type] = ...) -> List[Element]: ...
def find(self, path: _str_argument_type, namespaces: Optional[Dict[_str_argument_type, _str_argument_type]] = ...) -> Optional[Element]: ...
def findtext(self, path: _str_argument_type, default: Optional[_T] = ..., namespaces: Optional[Dict[_str_argument_type, _str_argument_type]] = ...) -> Union[_T, _str_result_type]: ...
@overload
def findtext(self, path: _str_argument_type, *, namespaces: Optional[Dict[_str_argument_type, _str_argument_type]] = ...) -> Optional[_str_result_type]: ...
@overload
def findtext(self, path: _str_argument_type, default: _T, namespaces: Optional[Dict[_str_argument_type, _str_argument_type]] = ...) -> Union[_T, _str_result_type]: ...
def findall(self, path: _str_argument_type, namespaces: Optional[Dict[_str_argument_type, _str_argument_type]] = ...) -> List[Element]: ...
def iterfind(self, path: _str_argument_type, namespaces: Optional[Dict[_str_argument_type, _str_argument_type]] = ...) -> List[Element]: ...
if sys.version_info >= (3, 4):