mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 21:14:48 +08:00
Big diff: Use new "|" union syntax (#5872)
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
import sys
|
||||
from typing import IO, Any, Iterable, List, NoReturn, Optional, Union
|
||||
from typing import IO, Any, Iterable, List, NoReturn
|
||||
from xml.sax.handler import ContentHandler, ErrorHandler
|
||||
from xml.sax.xmlreader import Locator, XMLReader
|
||||
|
||||
class SAXException(Exception):
|
||||
def __init__(self, msg: str, exception: Optional[Exception] = ...) -> None: ...
|
||||
def __init__(self, msg: str, exception: Exception | None = ...) -> None: ...
|
||||
def getMessage(self) -> str: ...
|
||||
def getException(self) -> Exception: ...
|
||||
def __getitem__(self, ix: Any) -> NoReturn: ...
|
||||
@@ -28,6 +28,6 @@ if sys.version_info >= (3, 8):
|
||||
else:
|
||||
def make_parser(parser_list: List[str] = ...) -> XMLReader: ...
|
||||
|
||||
def parse(source: Union[str, IO[str], IO[bytes]], handler: ContentHandler, errorHandler: ErrorHandler = ...) -> None: ...
|
||||
def parseString(string: Union[bytes, str], handler: ContentHandler, errorHandler: Optional[ErrorHandler] = ...) -> None: ...
|
||||
def parse(source: str | IO[str] | IO[bytes], handler: ContentHandler, errorHandler: ErrorHandler = ...) -> None: ...
|
||||
def parseString(string: bytes | str, handler: ContentHandler, errorHandler: ErrorHandler | None = ...) -> None: ...
|
||||
def _create_parser(parser_name: str) -> XMLReader: ...
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from _typeshed import SupportsWrite
|
||||
from codecs import StreamReaderWriter, StreamWriter
|
||||
from io import RawIOBase, TextIOBase
|
||||
from typing import Mapping, Optional, Union
|
||||
from typing import Mapping
|
||||
from xml.sax import handler, xmlreader
|
||||
|
||||
def escape(data: str, entities: Mapping[str, str] = ...) -> str: ...
|
||||
@@ -11,7 +11,7 @@ def quoteattr(data: str, entities: Mapping[str, str] = ...) -> str: ...
|
||||
class XMLGenerator(handler.ContentHandler):
|
||||
def __init__(
|
||||
self,
|
||||
out: Optional[Union[TextIOBase, RawIOBase, StreamWriter, StreamReaderWriter, SupportsWrite[str]]] = ...,
|
||||
out: TextIOBase | RawIOBase | StreamWriter | StreamReaderWriter | SupportsWrite[str] | None = ...,
|
||||
encoding: str = ...,
|
||||
short_empty_elements: bool = ...,
|
||||
) -> None: ...
|
||||
@@ -28,7 +28,7 @@ class XMLGenerator(handler.ContentHandler):
|
||||
def processingInstruction(self, target, data): ...
|
||||
|
||||
class XMLFilterBase(xmlreader.XMLReader):
|
||||
def __init__(self, parent: Optional[xmlreader.XMLReader] = ...) -> None: ...
|
||||
def __init__(self, parent: xmlreader.XMLReader | None = ...) -> None: ...
|
||||
def error(self, exception): ...
|
||||
def fatalError(self, exception): ...
|
||||
def warning(self, exception): ...
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Mapping, Optional, Tuple
|
||||
from typing import Mapping, Tuple
|
||||
|
||||
class XMLReader:
|
||||
def __init__(self) -> None: ...
|
||||
@@ -32,7 +32,7 @@ class Locator:
|
||||
def getSystemId(self): ...
|
||||
|
||||
class InputSource:
|
||||
def __init__(self, system_id: Optional[str] = ...) -> None: ...
|
||||
def __init__(self, system_id: str | None = ...) -> None: ...
|
||||
def setPublicId(self, public_id): ...
|
||||
def getPublicId(self): ...
|
||||
def setSystemId(self, system_id): ...
|
||||
|
||||
Reference in New Issue
Block a user