From 191e153427ac334ef3d3e1177e583b3852e0f609 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Val=C3=A9rian=20Rousset?= Date: Mon, 30 May 2016 18:51:34 +0200 Subject: [PATCH] more closely fit to html.parser documentation (#231) --- stdlib/3/html/parser.pyi | 47 ++++++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/stdlib/3/html/parser.pyi b/stdlib/3/html/parser.pyi index 4328f3f77..f49627d33 100644 --- a/stdlib/3/html/parser.pyi +++ b/stdlib/3/html/parser.pyi @@ -1,28 +1,33 @@ -from typing import AnyStr, List, Tuple +from typing import List, Tuple from _markupbase import ParserBase +import sys class HTMLParser(ParserBase): - def __init__(self, *args, convert_charrefs: bool) -> None: ... - def feed(self, feed: AnyStr) -> None: ... + if sys.version_info >= (3, 5): + def __init__(self, *, convert_charrefs: bool = ...) -> None: ... + elif sys.version_info >= (3, 4): + def __init__(self, strict: bool = ..., *, # type: ignore + convert_charrefs: bool = ...) -> None: ... + else: + def __init__(self, strict: bool = ...) -> None: ... # type: ignore + def feed(self, feed: str) -> None: ... def close(self) -> None: ... def reset(self) -> None: ... + def getpos(self) -> Tuple[int, int]: ... + def get_starttag_text(self) -> str: ... - def get_starttag_text(self) -> AnyStr: ... - def set_cdata_mode(self, AnyStr) -> None: ... - def clear_cdata_mode(self) -> None: ... + def handle_starttag(self, tag: str, + attrs: List[Tuple[str, str]]) -> None: ... + def handle_endtag(self, tag: str) -> None: ... + def handle_startendtag(self, tag: str, + attrs: List[Tuple[str, str]]) -> None: ... + def handle_data(self, data: str) -> None: ... + def handle_entityref(self, name: str) -> None: ... + def handle_charref(self, name: str) -> None: ... + def handle_comment(self, data: str) -> None: ... + def handle_decl(self, decl: str) -> None: ... + def handle_pi(self, data: str) -> None: ... + def unknown_decl(self, data: str) -> None: ... - def handle_startendtag(self, tag: AnyStr, attrs: List[Tuple[AnyStr, AnyStr]]): ... - def handle_starttag(self, tag: AnyStr, attrs: List[Tuple[AnyStr, AnyStr]]): ... - def handle_endtag(self, tag: AnyStr): ... - def handle_charref(self, name: AnyStr): ... - def handle_entityref(self, name: AnyStr): ... - def handle_data(self, data: AnyStr): ... - def handle_comment(self, data: AnyStr): ... - def handle_decl(self, decl: AnyStr): ... - def handle_pi(self, data: AnyStr): ... - - def unknown_decl(self, data: AnyStr): ... - - def unescape(self, s: AnyStr) -> AnyStr: ... - -class HTMLParseError(Exception): ... +if sys.version_info < (3, 5): + class HTMLParseError(Exception): ...