xml: stubtest fixes (#7890)

This commit is contained in:
Jelle Zijlstra
2022-05-20 04:03:45 -07:00
committed by GitHub
parent 611fa18b5c
commit e7cbde0928
9 changed files with 41 additions and 46 deletions

View File

@@ -33,6 +33,8 @@ class XMLParserType:
def ExternalEntityParserCreate(self, __context: str | None, __encoding: str = ...) -> XMLParserType: ...
def SetParamEntityParsing(self, __flag: int) -> int: ...
def UseForeignDTD(self, __flag: bool = ...) -> None: ...
@property
def intern(self) -> dict[str, str]: ...
buffer_size: int
buffer_text: bool
buffer_used: int
@@ -69,6 +71,7 @@ class XMLParserType:
DefaultHandlerExpand: Callable[[str], Any] | None
NotStandaloneHandler: Callable[[], int] | None
ExternalEntityRefHandler: Callable[[str, str | None, str | None, str | None], int] | None
SkippedEntityHandler: Callable[[str, bool], Any] | None
def ErrorString(__code: int) -> str: ...

View File

@@ -1,3 +1,5 @@
import sys
codes: dict[str, int]
messages: dict[int, str]
@@ -38,3 +40,10 @@ XML_ERROR_UNDEFINED_ENTITY: str
XML_ERROR_UNEXPECTED_STATE: str
XML_ERROR_UNKNOWN_ENCODING: str
XML_ERROR_XML_DECL: str
if sys.version_info >= (3, 11):
XML_ERROR_RESERVED_PREFIX_XML: str
XML_ERROR_RESERVED_PREFIX_XMLNS: str
XML_ERROR_RESERVED_NAMESPACE_URI: str
XML_ERROR_INVALID_ARGUMENT: str
XML_ERROR_NO_BUFFER: str
XML_ERROR_AMPLIFICATION_LIMIT_BREACH: str

View File

@@ -1,6 +1,6 @@
from typing import Any
import sys
version: Any
version: str
class ErrorHandler:
def error(self, exception): ...
@@ -30,17 +30,25 @@ class DTDHandler:
class EntityResolver:
def resolveEntity(self, publicId, systemId): ...
feature_namespaces: Any
feature_namespace_prefixes: Any
feature_string_interning: Any
feature_validation: Any
feature_external_ges: Any
feature_external_pes: Any
all_features: Any
property_lexical_handler: Any
property_declaration_handler: Any
property_dom_node: Any
property_xml_string: Any
property_encoding: Any
property_interning_dict: Any
all_properties: Any
feature_namespaces: str
feature_namespace_prefixes: str
feature_string_interning: str
feature_validation: str
feature_external_ges: str
feature_external_pes: str
all_features: list[str]
property_lexical_handler: str
property_declaration_handler: str
property_dom_node: str
property_xml_string: str
property_encoding: str
property_interning_dict: str
all_properties: list[str]
if sys.version_info >= (3, 10):
class LexicalHandler:
def comment(self, content: str) -> object: ...
def startDTD(self, name: str, public_id: str | None, system_id: str | None) -> object: ...
def endDTD(self) -> object: ...
def startCDATA(self) -> object: ...
def endCDATA(self) -> object: ...

View File

@@ -94,13 +94,8 @@ multiprocessing.managers.SharedMemoryServer.public
multiprocessing.managers.SharedMemoryServer.release_segment
multiprocessing.managers.SharedMemoryServer.shutdown
multiprocessing.managers.SharedMemoryServer.track_segment
pyexpat.XMLParserType.SkippedEntityHandler
pyexpat.XMLParserType.intern
typing._SpecialForm.__call__
unicodedata.UCD.is_normalized
xml.parsers.expat.XMLParserType.SkippedEntityHandler
xml.parsers.expat.XMLParserType.intern
xml.sax.handler.LexicalHandler
# ==========
# Related to positional-only arguments

View File

@@ -78,14 +78,6 @@ platform.uname_result.processor
pydoc.HTMLDoc.heading
pydoc.HTMLDoc.multicolumn
pydoc.HTMLDoc.section
pyexpat.XMLParserType.SkippedEntityHandler
pyexpat.XMLParserType.intern
pyexpat.errors.XML_ERROR_AMPLIFICATION_LIMIT_BREACH
pyexpat.errors.XML_ERROR_INVALID_ARGUMENT
pyexpat.errors.XML_ERROR_NO_BUFFER
pyexpat.errors.XML_ERROR_RESERVED_NAMESPACE_URI
pyexpat.errors.XML_ERROR_RESERVED_PREFIX_XML
pyexpat.errors.XML_ERROR_RESERVED_PREFIX_XMLNS
queue.SimpleQueue.__init__
shutil.rmtree
socketserver.UDPServer.allow_reuse_port
@@ -117,15 +109,6 @@ unittest.doModuleCleanups
urllib.request.FancyURLopener.http_error_308
urllib.request.HTTPRedirectHandler.http_error_308
weakref.WeakValueDictionary.update
xml.parsers.expat.XMLParserType.SkippedEntityHandler
xml.parsers.expat.XMLParserType.intern
xml.parsers.expat.errors.XML_ERROR_AMPLIFICATION_LIMIT_BREACH
xml.parsers.expat.errors.XML_ERROR_INVALID_ARGUMENT
xml.parsers.expat.errors.XML_ERROR_NO_BUFFER
xml.parsers.expat.errors.XML_ERROR_RESERVED_NAMESPACE_URI
xml.parsers.expat.errors.XML_ERROR_RESERVED_PREFIX_XML
xml.parsers.expat.errors.XML_ERROR_RESERVED_PREFIX_XMLNS
xml.sax.handler.LexicalHandler
xmlrpc.server.SimpleXMLRPCRequestHandler.rpc_paths
zipfile.Path.stem
zipfile.Path.suffix

View File

@@ -177,3 +177,6 @@ sqlite3.dbapi2.Binary.__iter__ # C type that implements __getitem__
sqlite3.dbapi2.Binary.cast # inspect.signature is incorrect about shape being kw-only
sqlite3.Binary.__iter__ # C type that implements __getitem__
sqlite3.Binary.cast # inspect.signature is incorrect about shape being kw-only
pyexpat.XMLParserType.intern # does exist but stubtest can't see it (https://github.com/python/cpython/blob/3.7/Modules/pyexpat.c#L1322)
xml.parsers.expat.XMLParserType.intern # does exist but stubtest can't see it (https://github.com/python/cpython/blob/3.7/Modules/pyexpat.c#L1322)

View File

@@ -170,6 +170,8 @@ queue.SimpleQueue.__init__
pyexpat.XMLParserType.ExternalEntityParserCreate # C signature is wrong - function gets only positional args
xml.parsers.expat.XMLParserType.ExternalEntityParserCreate # C signature is wrong - function gets only positional args
pyexpat.XMLParserType.intern # does exist but stubtest can't see it (https://github.com/python/cpython/blob/3.7/Modules/pyexpat.c#L1322)
xml.parsers.expat.XMLParserType.intern # does exist but stubtest can't see it (https://github.com/python/cpython/blob/3.7/Modules/pyexpat.c#L1322)
# White lies around defaults
dataclasses.field

View File

@@ -129,8 +129,6 @@ multiprocessing.managers.SharedMemoryServer.shutdown
multiprocessing.managers.SharedMemoryServer.track_segment
plistlib.Data.asBase64
plistlib.Data.fromBase64
pyexpat.XMLParserType.SkippedEntityHandler
pyexpat.XMLParserType.intern
stringprep.unicodedata # re-exported from unicodedata
tempfile.SpooledTemporaryFile.softspace
tkinter.Tk.split
@@ -153,8 +151,6 @@ tkinter.simpledialog.wantobjects
tkinter.tix.wantobjects
typing._SpecialForm.__call__
unicodedata.UCD.is_normalized
xml.parsers.expat.XMLParserType.SkippedEntityHandler
xml.parsers.expat.XMLParserType.intern
# ==========
# Allowlist entries that cannot or should not be fixed

View File

@@ -132,15 +132,11 @@ multiprocessing.managers.SharedMemoryServer.public
multiprocessing.managers.SharedMemoryServer.release_segment
multiprocessing.managers.SharedMemoryServer.shutdown
multiprocessing.managers.SharedMemoryServer.track_segment
pyexpat.XMLParserType.SkippedEntityHandler
pyexpat.XMLParserType.intern
stringprep.unicodedata # re-exported from unicodedata
types.GenericAlias.__mro_entries__
typing._SpecialForm.__call__
typing._SpecialForm.__mro_entries__
unicodedata.UCD.is_normalized
xml.parsers.expat.XMLParserType.SkippedEntityHandler
xml.parsers.expat.XMLParserType.intern
# SpooledTemporaryFile implements IO except these methods before Python 3.11
# See also https://github.com/python/typeshed/pull/2452#issuecomment-420657918