Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions stubs/html5lib/METADATA.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
version = "1.1.*"
upstream_repository = "https://github.com/html5lib/html5lib-python"
partial_stub = true

[tool.stubtest]
ignore_missing_stub = true
extras = ["all"]
6 changes: 5 additions & 1 deletion stubs/html5lib/html5lib/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
from typing import Final

from .html5parser import HTMLParser as HTMLParser, parse as parse, parseFragment as parseFragment
from .serializer import serialize as serialize
from .treebuilders import getTreeBuilder as getTreeBuilder
from .treewalkers import getTreeWalker as getTreeWalker

__version__: str
__all__ = ["HTMLParser", "parse", "parseFragment", "getTreeBuilder", "getTreeWalker", "serialize"]

__version__: Final[str]
48 changes: 25 additions & 23 deletions stubs/html5lib/html5lib/_ihatexml.pyi
Original file line number Diff line number Diff line change
@@ -1,39 +1,41 @@
from typing import Any
import re
from _typeshed import Incomplete
from collections.abc import Iterable

baseChar: str
ideographic: str
combiningCharacter: str
digit: str
extender: str
letter: Any
name: Any
nameFirst: Any
reChar: Any
reCharRange: Any
letter: str
name: str
nameFirst: str
reChar: re.Pattern[str]
reCharRange: re.Pattern[str]

def charStringToList(chars): ...
def normaliseCharList(charList): ...
def charStringToList(chars: str) -> list[str]: ...
def normaliseCharList(charList: Iterable[str]) -> list[str]: ...

max_unicode: Any
max_unicode: int

def missingRanges(charList): ...
def missingRanges(charList: Iterable[str]) -> list[str]: ...
def listToRegexpStr(charList): ...
def hexToInt(hex_str): ...
def escapeRegexp(string): ...
def hexToInt(hex_str: str | bytes | bytearray) -> int: ...
def escapeRegexp(string: str) -> str: ...

nonXmlNameBMPRegexp: Any
nonXmlNameFirstBMPRegexp: Any
nonPubidCharRegexp: Any
nonXmlNameBMPRegexp: re.Pattern[str]
nonXmlNameFirstBMPRegexp: re.Pattern[str]
nonPubidCharRegexp: re.Pattern[str]

class InfosetFilter:
replacementRegexp: Any
dropXmlnsLocalName: Any
dropXmlnsAttrNs: Any
preventDoubleDashComments: Any
preventDashAtCommentEnd: Any
replaceFormFeedCharacters: Any
preventSingleQuotePubid: Any
replaceCache: Any
replacementRegexp: re.Pattern[str]
dropXmlnsLocalName: Incomplete
dropXmlnsAttrNs: Incomplete
preventDoubleDashComments: Incomplete
preventDashAtCommentEnd: Incomplete
replaceFormFeedCharacters: Incomplete
preventSingleQuotePubid: Incomplete
replaceCache: Incomplete
def __init__(
self,
dropXmlnsLocalName: bool = False,
Expand Down
54 changes: 27 additions & 27 deletions stubs/html5lib/html5lib/_inputstream.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from _typeshed import SupportsRead
from _typeshed import Incomplete, SupportsRead
from codecs import CodecInfo
from typing import Any, Protocol, overload
from typing import Protocol, overload
from typing_extensions import TypeAlias

# Is actually webencodings.Encoding
Expand All @@ -13,20 +13,20 @@ _UnicodeInputStream: TypeAlias = str | SupportsRead[str]
_BinaryInputStream: TypeAlias = bytes | SupportsRead[bytes]
_InputStream: TypeAlias = _UnicodeInputStream | _BinaryInputStream # noqa: Y047 # used in other files

spaceCharactersBytes: Any
asciiLettersBytes: Any
asciiUppercaseBytes: Any
spacesAngleBrackets: Any
spaceCharactersBytes: Incomplete
asciiLettersBytes: Incomplete
asciiUppercaseBytes: Incomplete
spacesAngleBrackets: Incomplete
invalid_unicode_no_surrogate: str
invalid_unicode_re: Any
non_bmp_invalid_codepoints: Any
ascii_punctuation_re: Any
charsUntilRegEx: Any
invalid_unicode_re: Incomplete
non_bmp_invalid_codepoints: Incomplete
ascii_punctuation_re: Incomplete
charsUntilRegEx: Incomplete

class BufferedStream:
stream: Any
buffer: Any
position: Any
stream: Incomplete
buffer: Incomplete
position: Incomplete
def __init__(self, stream) -> None: ...
def tell(self): ...
def seek(self, pos) -> None: ...
Expand All @@ -47,10 +47,10 @@ def HTMLInputStream(
) -> HTMLBinaryInputStream: ...

class HTMLUnicodeInputStream:
reportCharacterErrors: Any
newLines: Any
reportCharacterErrors: Incomplete
newLines: Incomplete
charEncoding: tuple[_Encoding, str]
dataStream: Any
dataStream: Incomplete
def __init__(self, source: _UnicodeInputStream) -> None: ...
chunk: str
chunkSize: int
Expand All @@ -69,14 +69,14 @@ class HTMLUnicodeInputStream:
def unget(self, char) -> None: ...

class HTMLBinaryInputStream(HTMLUnicodeInputStream):
rawStream: Any
rawStream: Incomplete
numBytesMeta: int
numBytesChardet: int
override_encoding: Any
transport_encoding: Any
same_origin_parent_encoding: Any
likely_encoding: Any
default_encoding: Any
override_encoding: Incomplete
transport_encoding: Incomplete
same_origin_parent_encoding: Incomplete
likely_encoding: Incomplete
default_encoding: Incomplete
charEncoding: tuple[_Encoding, str]
def __init__(
self,
Expand All @@ -88,7 +88,7 @@ class HTMLBinaryInputStream(HTMLUnicodeInputStream):
default_encoding: str = "windows-1252",
useChardet: bool = True,
) -> None: ...
dataStream: Any
dataStream: Incomplete
def reset(self) -> None: ...
def openStream(self, source): ...
def determineEncoding(self, chardet: bool = True): ...
Expand All @@ -105,7 +105,7 @@ class EncodingBytes(bytes):
def previous(self): ...
def setPosition(self, position) -> None: ...
def getPosition(self): ...
position: Any
position: Incomplete
def getCurrentByte(self): ...
@property
def currentByte(self): ...
Expand All @@ -115,8 +115,8 @@ class EncodingBytes(bytes):
def jumpTo(self, bytes): ...

class EncodingParser:
data: Any
encoding: Any
data: Incomplete
encoding: Incomplete
def __init__(self, data) -> None: ...
def getEncoding(self): ...
def handleComment(self): ...
Expand All @@ -128,7 +128,7 @@ class EncodingParser:
def getAttribute(self): ...

class ContentAttrParser:
data: Any
data: Incomplete
def __init__(self, data) -> None: ...
def parse(self): ...

Expand Down
16 changes: 8 additions & 8 deletions stubs/html5lib/html5lib/_tokenizer.pyi
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
from typing import Any
from _typeshed import Incomplete

from ._inputstream import _InputStream

entitiesTrie: Any
entitiesTrie: Incomplete
attributeMap = dict

class HTMLTokenizer:
stream: Any
parser: Any
stream: Incomplete
parser: Incomplete
escapeFlag: bool
lastFourChars: Any
state: Any
lastFourChars: Incomplete
state: Incomplete
escape: bool
currentToken: Any
currentToken: Incomplete
def __init__(self, stream: _InputStream, parser=None, **kwargs) -> None: ...
tokenQueue: Any
tokenQueue: Incomplete
def __iter__(self): ...
def consumeNumberEntity(self, isHex): ...
def consumeEntity(self, allowedChar=None, fromAttribute: bool = False) -> None: ...
Expand Down
2 changes: 2 additions & 0 deletions stubs/html5lib/html5lib/_trie/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
from .py import Trie as Trie

__all__ = ["Trie"]
4 changes: 2 additions & 2 deletions stubs/html5lib/html5lib/_trie/_base.pyi
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from _typeshed import Incomplete
from abc import ABCMeta
from collections.abc import Mapping
from typing import Any

class Trie(Mapping[Any, Any], metaclass=ABCMeta):
class Trie(Mapping[Incomplete, Incomplete], metaclass=ABCMeta):
def keys(self, prefix=None): ...
def has_keys_with_prefix(self, prefix): ...
def longest_prefix(self, prefix): ...
Expand Down
22 changes: 16 additions & 6 deletions stubs/html5lib/html5lib/_utils.pyi
Original file line number Diff line number Diff line change
@@ -1,17 +1,27 @@
import xml.etree.ElementTree as default_etree
from _typeshed import Incomplete
from collections.abc import Mapping
from typing import Any

__all__ = [
"default_etree",
"MethodDispatcher",
"isSurrogatePair",
"surrogatePairToCodepoint",
"moduleFactoryFactory",
"supports_lone_surrogates",
]

supports_lone_surrogates: bool

class MethodDispatcher(dict[Any, Any]):
default: Any
class MethodDispatcher(dict[Incomplete, Incomplete]):
default: Incomplete
def __init__(self, items=()) -> None: ...
def __getitem__(self, key): ...
def __get__(self, instance, owner=None): ...

class BoundMethodDispatcher(Mapping[Any, Any]):
instance: Any
dispatcher: Any
class BoundMethodDispatcher(Mapping[Incomplete, Incomplete]):
instance: Incomplete
dispatcher: Incomplete
def __init__(self, instance, dispatcher) -> None: ...
def __getitem__(self, key): ...
def get(self, key, default): ... # type: ignore[override]
Expand Down
66 changes: 33 additions & 33 deletions stubs/html5lib/html5lib/constants.pyi
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
from typing import Any
from _typeshed import Incomplete

EOF: Any
E: Any
namespaces: Any
scopingElements: Any
formattingElements: Any
specialElements: Any
htmlIntegrationPointElements: Any
mathmlTextIntegrationPointElements: Any
adjustSVGAttributes: Any
adjustMathMLAttributes: Any
adjustForeignAttributes: Any
unadjustForeignAttributes: Any
spaceCharacters: Any
tableInsertModeElements: Any
asciiLowercase: Any
asciiUppercase: Any
asciiLetters: Any
digits: Any
hexDigits: Any
asciiUpper2Lower: Any
headingElements: Any
voidElements: Any
cdataElements: Any
rcdataElements: Any
booleanAttributes: Any
entitiesWindows1252: Any
xmlEntities: Any
entities: Any
replacementCharacters: Any
tokenTypes: Any
tagTokenTypes: Any
prefixes: Any
EOF: Incomplete
E: dict[str, str]
namespaces: dict[str, str]
scopingElements: frozenset[tuple[str, str]]
formattingElements: frozenset[tuple[str, str]]
specialElements: frozenset[tuple[str, str]]
htmlIntegrationPointElements: frozenset[tuple[str, str]]
mathmlTextIntegrationPointElements: frozenset[tuple[str, str]]
adjustSVGAttributes: dict[str, str]
adjustMathMLAttributes: dict[str, str]
adjustForeignAttributes: dict[str, tuple[str, str, str] | tuple[None, str, str]]
unadjustForeignAttributes: dict[tuple[str, str], str]
spaceCharacters: frozenset[str]
tableInsertModeElements: frozenset[str]
asciiLowercase: frozenset[str]
asciiUppercase: frozenset[str]
asciiLetters: frozenset[str]
digits: frozenset[str]
hexDigits: frozenset[str]
asciiUpper2Lower: dict[int, int]
headingElements: tuple[str, ...]
voidElements: frozenset[str]
cdataElements: frozenset[str]
rcdataElements: frozenset[str]
booleanAttributes: dict[str, frozenset[str]]
entitiesWindows1252: tuple[int, ...]
xmlEntities: frozenset[str]
entities: dict[str, str]
replacementCharacters: dict[int, str]
tokenTypes: dict[str, int]
tagTokenTypes: frozenset[int]
prefixes: dict[str, str]

class DataLossWarning(UserWarning): ...
class _ReparseException(Exception): ...
4 changes: 2 additions & 2 deletions stubs/html5lib/html5lib/filters/base.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from typing import Any
from _typeshed import Incomplete

class Filter:
source: Any
source: Incomplete
def __init__(self, source) -> None: ...
def __iter__(self): ...
def __getattr__(self, name: str): ...
6 changes: 2 additions & 4 deletions stubs/html5lib/html5lib/filters/inject_meta_charset.pyi
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
from typing import Any

from . import base

class Filter(base.Filter):
encoding: Any
def __init__(self, source, encoding) -> None: ...
encoding: str | None
def __init__(self, source, encoding: str | None) -> None: ...
def __iter__(self): ...
6 changes: 3 additions & 3 deletions stubs/html5lib/html5lib/filters/lint.pyi
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from typing import Any

from . import base

spaceCharacters: str

class Filter(base.Filter):
require_matching_tags: Any
require_matching_tags: bool
def __init__(self, source, require_matching_tags: bool = True) -> None: ...
def __iter__(self): ...
9 changes: 6 additions & 3 deletions stubs/html5lib/html5lib/filters/optionaltags.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
from _typeshed import Incomplete
from collections.abc import Generator

from . import base

class Filter(base.Filter):
def slider(self) -> None: ...
def slider(self) -> Generator[tuple[Incomplete, Incomplete, Incomplete]]: ...
def __iter__(self): ...
def is_optional_start(self, tagname, previous, next): ...
def is_optional_end(self, tagname, next): ...
def is_optional_start(self, tagname: str, previous, next) -> bool: ...
def is_optional_end(self, tagname: str, next) -> bool: ...
Loading