Skip to content

Commit 40f2cb6

Browse files
jpy-gitAlexWaygood
andauthored
HTMLParser: Add missing stubs for attributes and methods (#6658)
Co-authored-by: Alex Waygood <[email protected]>
1 parent bd0cbf4 commit 40f2cb6

File tree

4 files changed

+18
-7
lines changed

4 files changed

+18
-7
lines changed

stdlib/_markupbase.pyi

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
1+
import sys
2+
from typing import NoReturn
3+
14
class ParserBase:
25
def __init__(self) -> None: ...
3-
def error(self, message: str) -> None: ...
46
def reset(self) -> None: ...
57
def getpos(self) -> tuple[int, int]: ...
68
def unknown_decl(self, data: str) -> None: ...
9+
def parse_comment(self, i: int, report: int = ...) -> int: ... # undocumented
10+
def parse_declaration(self, i: int) -> int: ... # undocumented
11+
def parse_marked_section(self, i: int, report: int = ...) -> int: ... # undocumented
12+
def updatepos(self, i: int, j: int) -> int: ... # undocumented
13+
if sys.version_info < (3, 10):
14+
# Removed from ParserBase: https://bugs.python.org/issue31844
15+
def error(self, message: str) -> NoReturn: ... # undocumented
16+
lineno: int # undocumented
17+
offset: int # undocumented

stdlib/html/parser.pyi

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from _markupbase import ParserBase
2-
from typing import Tuple
2+
from typing import Pattern, Tuple
33

44
class HTMLParser(ParserBase):
55
def __init__(self, *, convert_charrefs: bool = ...) -> None: ...
@@ -28,3 +28,8 @@ class HTMLParser(ParserBase):
2828
def parse_pi(self, i: int) -> int: ... # undocumented
2929
def parse_starttag(self, i: int) -> int: ... # undocumented
3030
def set_cdata_mode(self, elem: str) -> None: ... # undocumented
31+
rawdata: str # undocumented
32+
cdata_elem: str | None # undocumented
33+
convert_charrefs: bool # undocumented
34+
interesting: Pattern[str] # undocumented
35+
lasttag: str # undocumented

tests/stubtest_allowlists/py310.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@ pstats.SortKey.__new__
121121
tkinter.EventType.__new__
122122

123123
# Rest of these errors are new in Python 3.10:
124-
_markupbase.ParserBase.error
125124
asyncio.proactor_events._ProactorReadPipeTransport.__init__
126125
distutils.command.bdist_wininst
127126
py_compile.main

tests/stubtest_allowlists/py3_common.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -546,10 +546,6 @@ pkgutil.ImpLoader.source
546546
# ==========
547547
__main__.\w+
548548
_json.encode_basestring
549-
_markupbase.ParserBase.parse_comment
550-
_markupbase.ParserBase.parse_declaration
551-
_markupbase.ParserBase.parse_marked_section
552-
_markupbase.ParserBase.updatepos
553549
_thread.LockType.acquire_lock
554550
_thread.LockType.locked_lock
555551
_thread.LockType.release_lock

0 commit comments

Comments
 (0)