Fix instantiating a xml.etree.ElementTree.Element (#1930)

The methods removed by https://github.com/python/typeshed/pull/1816
are abstract in `MutableSequence` and therefore must be specified on `Element`.
This commit is contained in:
Roy Williams
2018-02-27 17:59:11 -05:00
committed by Jelle Zijlstra
parent c9eead5890
commit a618ee30d4

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, 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
import io
import sys
@@ -70,6 +70,17 @@ class Element(MutableSequence['Element']):
def remove(self, subelement: 'Element') -> None: ...
def set(self, key: _str_argument_type, value: _str_argument_type) -> None: ...
def __bool__(self) -> bool: ...
def __delitem__(self, i: Union[int, slice]) -> None: ...
@overload
def __getitem__(self, i: int) -> 'Element': ...
@overload
def __getitem__(self, s: slice) -> Sequence['Element']: ...
def __len__(self) -> int: ...
@overload
def __setitem__(self, i: int, o: 'Element') -> None: ...
@overload
def __setitem__(self, s: slice, o: Iterable['Element']) -> None: ...
def SubElement(parent: Element, tag: _str_argument_type, attrib: Dict[_str_argument_type, _str_argument_type]=..., **extra: _str_argument_type) -> Element: ...
def Comment(text: _str_argument_type=...) -> Element: ...