|
1 | 1 | # Stubs for xml.etree.ElementTree
|
2 | 2 |
|
3 |
| -from typing import Any, Callable, Dict, Generator, IO, ItemsView, Iterable, Iterator, KeysView, List, MutableSequence, Optional, overload, Sequence, Text, Tuple, TypeVar, Union |
| 3 | +from typing import Any, Callable, Dict, Generator, IO, ItemsView, Iterable, Iterator, KeysView, List, MutableSequence, Optional, overload, Sequence, Text, Tuple, TypeVar, Union, overload |
4 | 4 | import io
|
5 | 5 | import sys
|
6 | 6 |
|
@@ -53,8 +53,14 @@ class Element(MutableSequence[Element]):
|
53 | 53 | def extend(self, elements: Iterable[Element]) -> None: ...
|
54 | 54 | def find(self, path: _str_argument_type, namespaces: Optional[Dict[_str_argument_type, _str_argument_type]] = ...) -> Optional[Element]: ...
|
55 | 55 | def findall(self, path: _str_argument_type, namespaces: Optional[Dict[_str_argument_type, _str_argument_type]] = ...) -> List[Element]: ...
|
56 |
| - def findtext(self, path: _str_argument_type, default: Optional[_T] = ..., namespaces: Optional[Dict[_str_argument_type, _str_argument_type]] = ...) -> Union[_T, _str_result_type]: ... |
57 |
| - def get(self, key: _str_argument_type, default: Optional[_T] = ...) -> Union[_str_result_type, _T]: ... |
| 56 | + @overload |
| 57 | + def findtext(self, path: _str_argument_type, *, namespaces: Optional[Dict[_str_argument_type, _str_argument_type]] = ...) -> Optional[_str_result_type]: ... |
| 58 | + @overload |
| 59 | + def findtext(self, path: _str_argument_type, default: _T, namespaces: Optional[Dict[_str_argument_type, _str_argument_type]] = ...) -> Union[_T, _str_result_type]: ... |
| 60 | + @overload |
| 61 | + def get(self, key: _str_argument_type) -> Optional[_str_result_type]: ... |
| 62 | + @overload |
| 63 | + def get(self, key: _str_argument_type, default: _T) -> Union[_str_result_type, _T]: ... |
58 | 64 | def getchildren(self) -> List[Element]: ...
|
59 | 65 | def getiterator(self, tag: Optional[_str_argument_type] = ...) -> List[Element]: ...
|
60 | 66 | if sys.version_info >= (3, 2):
|
@@ -102,7 +108,10 @@ class ElementTree:
|
102 | 108 | def iter(self, tag: Optional[_str_argument_type] = ...) -> Generator[Element, None, None]: ...
|
103 | 109 | def getiterator(self, tag: Optional[_str_argument_type] = ...) -> List[Element]: ...
|
104 | 110 | def find(self, path: _str_argument_type, namespaces: Optional[Dict[_str_argument_type, _str_argument_type]] = ...) -> Optional[Element]: ...
|
105 |
| - def findtext(self, path: _str_argument_type, default: Optional[_T] = ..., namespaces: Optional[Dict[_str_argument_type, _str_argument_type]] = ...) -> Union[_T, _str_result_type]: ... |
| 111 | + @overload |
| 112 | + def findtext(self, path: _str_argument_type, *, namespaces: Optional[Dict[_str_argument_type, _str_argument_type]] = ...) -> Optional[_str_result_type]: ... |
| 113 | + @overload |
| 114 | + def findtext(self, path: _str_argument_type, default: _T, namespaces: Optional[Dict[_str_argument_type, _str_argument_type]] = ...) -> Union[_T, _str_result_type]: ... |
106 | 115 | def findall(self, path: _str_argument_type, namespaces: Optional[Dict[_str_argument_type, _str_argument_type]] = ...) -> List[Element]: ...
|
107 | 116 | def iterfind(self, path: _str_argument_type, namespaces: Optional[Dict[_str_argument_type, _str_argument_type]] = ...) -> List[Element]: ...
|
108 | 117 | if sys.version_info >= (3, 4):
|
|
0 commit comments