From fc54574b132001653d5d7be96270dc0632e1fede Mon Sep 17 00:00:00 2001 From: Nicola Soranzo Date: Sat, 27 Jan 2024 10:15:07 +0000 Subject: [PATCH] Declare `_Attrib` keys and values as exactly str, not _AnyStr (GH-99) --- lxml-stubs/etree.pyi | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lxml-stubs/etree.pyi b/lxml-stubs/etree.pyi index 90a985c..9c399a2 100644 --- a/lxml-stubs/etree.pyi +++ b/lxml-stubs/etree.pyi @@ -312,27 +312,27 @@ class _Attrib: ], ) -> None: ... @overload - def pop(self, key: _AnyStr) -> _AnyStr: ... + def pop(self, key: _AnyStr) -> str: ... @overload - def pop(self, key: _AnyStr, default: _AnyStr) -> _AnyStr: ... + def pop(self, key: _AnyStr, default: _T) -> Union[str, _T]: ... def clear(self) -> None: ... def __repr__(self) -> str: ... def __copy__(self) -> _DictAnyStr: ... def __deepcopy__(self, memo: Dict[Any, Any]) -> _DictAnyStr: ... - def __getitem__(self, key: _AnyStr) -> _AnyStr: ... + def __getitem__(self, key: _AnyStr) -> str: ... def __bool__(self) -> bool: ... def __len__(self) -> int: ... @overload def get(self, key: _TagName) -> Optional[str]: ... @overload def get(self, key: _TagName, default: _T) -> Union[str, _T]: ... - def keys(self) -> _ListAnyStr: ... - def __iter__(self) -> Iterator[_AnyStr]: ... # actually _AttribIterator - def iterkeys(self) -> Iterator[_AnyStr]: ... - def values(self) -> _ListAnyStr: ... - def itervalues(self) -> Iterator[_AnyStr]: ... - def items(self) -> List[Tuple[_AnyStr, _AnyStr]]: ... - def iteritems(self) -> Iterator[Tuple[_AnyStr, _AnyStr]]: ... + def keys(self) -> List[str]: ... + def __iter__(self) -> Iterator[str]: ... # actually _AttribIterator + def iterkeys(self) -> Iterator[str]: ... + def values(self) -> List[str]: ... + def itervalues(self) -> Iterator[str]: ... + def items(self) -> List[Tuple[str, str]]: ... + def iteritems(self) -> Iterator[Tuple[str, str]]: ... def has_key(self, key: _AnyStr) -> bool: ... def __contains__(self, key: _AnyStr) -> bool: ... def __richcmp__(self, other: _Attrib, op: int) -> bool: ...