From 7ab4d7f3e11c559739cb38e402ce5d90b891254c Mon Sep 17 00:00:00 2001 From: "Tan, Wei Jie" Date: Sun, 7 Jan 2024 16:32:51 +0800 Subject: [PATCH] attrib.get should have same signature as _element.get --- lxml-stubs/etree.pyi | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lxml-stubs/etree.pyi b/lxml-stubs/etree.pyi index 6797994..90a985c 100644 --- a/lxml-stubs/etree.pyi +++ b/lxml-stubs/etree.pyi @@ -322,7 +322,10 @@ class _Attrib: def __getitem__(self, key: _AnyStr) -> _AnyStr: ... def __bool__(self) -> bool: ... def __len__(self) -> int: ... - def get(self, key: _AnyStr, default: _AnyStr = ...) -> Optional[_AnyStr]: ... + @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]: ...