Skip to content

Commit

Permalink
Add missing public class attributes, properties and methods for ``_Lo…
Browse files Browse the repository at this point in the history
…gEntry`` and ``_ErrorLog``
  • Loading branch information
nsoranzo committed Feb 19, 2024
1 parent 4386c5b commit 0874496
Showing 1 changed file with 33 additions and 3 deletions.
36 changes: 33 additions & 3 deletions lxml-stubs/etree.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ 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: ...
Expand Down Expand Up @@ -374,7 +374,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,
Expand Down Expand Up @@ -578,10 +578,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 _BaseErrorLog:
last_error: _LogEntry
def copy(self) -> Self: ...
def receive(self, entry: _LogEntry) -> None: ...

class _ErrorLog:
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): ...

Expand Down

0 comments on commit 0874496

Please sign in to comment.