diff --git a/lxml-stubs/etree.pyi b/lxml-stubs/etree.pyi index a68b090..bae7f34 100644 --- a/lxml-stubs/etree.pyi +++ b/lxml-stubs/etree.pyi @@ -24,7 +24,14 @@ from typing import ( overload, ) -from typing_extensions import Literal, Protocol, SupportsIndex, TypeAlias, TypeGuard +from typing_extensions import ( + Literal, + Protocol, + Self, + SupportsIndex, + TypeAlias, + TypeGuard, +) # dummy for missing stubs def __getattr__(name: str) -> Any: ... @@ -374,7 +381,7 @@ class CustomElementClassLookup(FallbackElementClassLookup): class _BaseParser: def __getattr__(self, name: str) -> Any: ... # Incomplete - def copy(self) -> _BaseParser: ... + def copy(self) -> Self: ... def makeelement( self, _tag: _TagName, @@ -578,10 +585,40 @@ def tostring( ) -> _AnyStr: ... class _LogEntry: + column: int + domain: int + level: int + line: int path: Optional[str] + type: int + @property + def domain_name(self) -> str: ... + @property + def filename(self) -> Optional[str]: ... + @property + def level_name(self) -> str: ... + @property + def message(self) -> Optional[str]: ... + @property + def type_name(self) -> str: ... -class _ErrorLog: +class _BaseErrorLog: + last_error: _LogEntry + def copy(self) -> Self: ... + def receive(self, entry: _LogEntry) -> None: ... + +class _ListErrorLog(_BaseErrorLog): def __iter__(self) -> Iterator["_LogEntry"]: ... + def filter_domains(self, domains: Union[int, Iterable[int]]) -> Self: ... + def filter_from_errors(self) -> Self: ... + def filter_from_fatals(self) -> Self: ... + def filter_from_level(self, level: int) -> Self: ... + def filter_from_warnings(self) -> Self: ... + def filter_levels(self, levels: Union[int, Iterable[int]]) -> Self: ... + def filter_types(self, types: Union[int, Iterable[int]]) -> Self: ... + +class _ErrorLog(_ListErrorLog): + def clear(self) -> None: ... class Error(Exception): ...