stdlib/xml/sax: Add type annotations (#10606)

* stdlib/xml/sax: Type annotations for commonly used methods.

* stdlib/xml/sax: More annotations.

It turns out SAX's definition of a "qname" is exactly the opposite of
ElementTree's. With that understanding, let's annotate the Attributes*Impl
classes too.

* stdlib/xml/sax: I better understand what AttributesNSImpl is doing now.

* Update third-party library stubs to agree with the new SAX annotations.
This commit is contained in:
Screwtapello
2023-09-23 13:08:13 +10:00
committed by GitHub
parent 41bfc12065
commit 49b717ca52
6 changed files with 109 additions and 93 deletions

View File

@@ -1,7 +1,7 @@
from collections.abc import Iterator, Mapping
from typing import Any
from typing_extensions import Self
from xml.sax import handler
from xml.sax import handler, xmlreader
def is_string(x: object) -> bool: ...
@@ -29,7 +29,7 @@ class Handler(handler.ContentHandler):
root: Element
elements: list[Element]
def __init__(self) -> None: ...
def startElement(self, name: str, attributes: Mapping[str, Any]) -> None: ...
def startElement(self, name: str, attributes: xmlreader.AttributesImpl) -> None: ...
def endElement(self, name: str) -> None: ...
def characters(self, cdata: str) -> None: ...