1 from collections.abc import Iterable, Iterator
2 from logging import Logger
3 from typing import Any, Tuple
4 from typing_extensions import Literal
8 def chardet_dammit(s): ...
14 class EntitySubstitution:
15 CHARACTER_TO_HTML_ENTITY: Any
16 HTML_ENTITY_TO_CHARACTER: Any
17 CHARACTER_TO_HTML_ENTITY_RE: Any
18 CHARACTER_TO_XML_ENTITY: Any
19 BARE_AMPERSAND_OR_BRACKET: Any
20 AMPERSAND_OR_BRACKET: Any
22 def quoted_attribute_value(cls, value): ...
24 def substitute_xml(cls, value, make_quoted_attribute: bool = ...): ...
26 def substitute_xml_containing_entities(cls, value, make_quoted_attribute: bool = ...): ...
28 def substitute_html(cls, s): ...
30 class EncodingDetector:
31 known_definite_encodings: list[str]
32 user_encodings: list[str]
33 exclude_encodings: set[str]
34 chardet_encoding: Any | None
36 declared_encoding: str | None
38 sniffed_encoding: str | None
42 known_definite_encodings: Iterable[str] | None = ...,
44 exclude_encodings: list[str] | None = ...,
45 user_encodings: list[str] | None = ...,
46 override_encodings: list[str] | None = ...,
49 def encodings(self) -> Iterator[str]: ...
51 def strip_byte_order_mark(cls, data): ...
53 def find_declared_encoding(cls, markup, is_html: bool = ..., search_entire_document: bool = ...) -> str | None: ...
56 CHARSET_ALIASES: dict[str, str]
57 ENCODINGS_WITH_SMART_QUOTES: list[str]
58 smart_quotes_to: Literal["ascii", "xml", "html"] | None
59 tried_encodings: list[tuple[str, str]]
60 contains_replacement_characters: bool
63 detector: EncodingDetector
66 original_encoding: Any | None
70 known_definite_encodings: list[str] | None = ...,
71 smart_quotes_to: Literal["ascii", "xml", "html"] | None = ...,
73 exclude_encodings: list[str] | None = ...,
74 user_encodings: list[str] | None = ...,
75 override_encodings: list[str] | None = ...,
78 def declared_html_encoding(self) -> str | None: ...
79 def find_codec(self, charset: str) -> str | None: ...
80 MS_CHARS: dict[bytes, str | Tuple[str, ...]]
81 MS_CHARS_TO_ASCII: dict[bytes, str]
82 WINDOWS_1252_TO_UTF8: dict[int, bytes]
83 MULTIBYTE_MARKERS_AND_SIZES: list[tuple[int, int, int]]
84 FIRST_MULTIBYTE_MARKER: int
85 LAST_MULTIBYTE_MARKER: int
87 def detwingle(cls, in_bytes: bytes, main_encoding: str = ..., embedded_encoding: str = ...) -> bytes: ...