mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-08 13:04:47 +08:00
56 lines
1.7 KiB
Python
56 lines
1.7 KiB
Python
from html.parser import HTMLParser
|
|
from typing import Any, List, Optional, Tuple, Union, TypeVar
|
|
|
|
_Self = TypeVar('_Self')
|
|
|
|
WHITESPACE: Any
|
|
|
|
def normalize_whitespace(string: str) -> str: ...
|
|
|
|
class Element:
|
|
name: Optional[str] = ...
|
|
attributes: List[Tuple[str, Optional[str]]] = ...
|
|
children: List[Union[Element, str]] = ...
|
|
def __init__(
|
|
self,
|
|
name: Optional[str],
|
|
attributes: Union[List[Tuple[str, Optional[str]]], Tuple],
|
|
) -> None: ...
|
|
def append(self, element: Union[Element, str]) -> None: ...
|
|
def finalize(self) -> None: ...
|
|
def __contains__(self, element: Union[Element, str]) -> bool: ...
|
|
def count(self, element: Union[Element, str]) -> int: ...
|
|
def __getitem__(self, key: int) -> Union[Element, str]: ...
|
|
|
|
class RootElement(Element):
|
|
attributes: List[Any]
|
|
children: List[Union[Element, str]]
|
|
def __init__(self) -> None: ...
|
|
|
|
class HTMLParseError(Exception): ...
|
|
|
|
class Parser(HTMLParser):
|
|
SELF_CLOSING_TAGS: Any = ...
|
|
root: Any = ...
|
|
open_tags: Any = ...
|
|
element_positions: Any = ...
|
|
def __init__(self) -> None: ...
|
|
def error(self, msg: str) -> Any: ...
|
|
def format_position(
|
|
self, position: None = ..., element: None = ...
|
|
) -> str: ...
|
|
@property
|
|
def current(self) -> Element: ...
|
|
def handle_startendtag(
|
|
self, tag: str, attrs: List[Tuple[str, Optional[str]]]
|
|
) -> None: ...
|
|
def handle_starttag(
|
|
self, tag: str, attrs: List[Tuple[str, Optional[str]]]
|
|
) -> None: ...
|
|
def handle_endtag(self, tag: str) -> None: ...
|
|
def handle_data(self, data: str) -> None: ...
|
|
def handle_charref(self, name: str) -> None: ...
|
|
def handle_entityref(self, name: str) -> None: ...
|
|
|
|
def parse_html(html: str) -> Element: ...
|