add xml.sax._exceptions module (#11147)

This commit is contained in:
Stephen Morton
2023-12-11 10:48:30 -08:00
committed by GitHub
parent 7ba83f3055
commit 1574ff3973
2 changed files with 28 additions and 19 deletions

View File

@@ -1,10 +1,17 @@
import sys
from _typeshed import ReadableBuffer, StrPath, SupportsRead, _T_co
from collections.abc import Iterable
from typing import Any, NoReturn, Protocol
from typing import Protocol
from typing_extensions import TypeAlias
from xml.sax._exceptions import (
SAXException as SAXException,
SAXNotRecognizedException as SAXNotRecognizedException,
SAXNotSupportedException as SAXNotSupportedException,
SAXParseException as SAXParseException,
SAXReaderNotAvailable as SAXReaderNotAvailable,
)
from xml.sax.handler import ContentHandler as ContentHandler, ErrorHandler as ErrorHandler
from xml.sax.xmlreader import Locator, XMLReader
from xml.sax.xmlreader import XMLReader
class _SupportsReadClose(SupportsRead[_T_co], Protocol[_T_co]):
def close(self) -> None: ...
@@ -14,23 +21,6 @@ if sys.version_info >= (3, 8):
else:
_Source: TypeAlias = str | _SupportsReadClose[bytes] | _SupportsReadClose[str]
class SAXException(Exception):
def __init__(self, msg: str, exception: Exception | None = None) -> None: ...
def getMessage(self) -> str: ...
def getException(self) -> Exception: ...
def __getitem__(self, ix: Any) -> NoReturn: ...
class SAXParseException(SAXException):
def __init__(self, msg: str, exception: Exception | None, locator: Locator) -> None: ...
def getColumnNumber(self) -> int: ...
def getLineNumber(self) -> int: ...
def getPublicId(self): ...
def getSystemId(self): ...
class SAXNotRecognizedException(SAXException): ...
class SAXNotSupportedException(SAXException): ...
class SAXReaderNotAvailable(SAXNotSupportedException): ...
default_parser_list: list[str]
if sys.version_info >= (3, 8):

View File

@@ -0,0 +1,19 @@
from typing import NoReturn
from xml.sax.xmlreader import Locator
class SAXException(Exception):
def __init__(self, msg: str, exception: Exception | None = None) -> None: ...
def getMessage(self) -> str: ...
def getException(self) -> Exception: ...
def __getitem__(self, ix: object) -> NoReturn: ...
class SAXParseException(SAXException):
def __init__(self, msg: str, exception: Exception | None, locator: Locator) -> None: ...
def getColumnNumber(self) -> int: ...
def getLineNumber(self) -> int: ...
def getPublicId(self): ...
def getSystemId(self): ...
class SAXNotRecognizedException(SAXException): ...
class SAXNotSupportedException(SAXException): ...
class SAXReaderNotAvailable(SAXNotSupportedException): ...