mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 21:14:48 +08:00
Switch to PEP-604 syntax in python2 stubs (#5915)
Signed-off-by: oleg.hoefling <oleg.hoefling@gmail.com>
This commit is contained in:
@@ -1,10 +1,8 @@
|
||||
from _typeshed.xml import DOMImplementation
|
||||
from typing import Callable, Dict, Iterable, Optional, Tuple, Union
|
||||
from typing import Callable, Dict, Iterable, Tuple
|
||||
|
||||
well_known_implementations: Dict[str, str]
|
||||
registered: Dict[str, Callable[[], DOMImplementation]]
|
||||
|
||||
def registerDOMImplementation(name: str, factory: Callable[[], DOMImplementation]) -> None: ...
|
||||
def getDOMImplementation(
|
||||
name: Optional[str] = ..., features: Union[str, Iterable[Tuple[str, Optional[str]]]] = ...
|
||||
) -> DOMImplementation: ...
|
||||
def getDOMImplementation(name: str | None = ..., features: str | Iterable[Tuple[str, str | None]] = ...) -> DOMImplementation: ...
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Any, Iterable, List, Optional, Tuple, Type, TypeVar
|
||||
from typing import Any, Iterable, List, Tuple, Type, TypeVar
|
||||
|
||||
_T = TypeVar("_T")
|
||||
|
||||
@@ -6,7 +6,7 @@ StringTypes: Tuple[Type[str]]
|
||||
|
||||
class NodeList(List[_T]):
|
||||
length: int
|
||||
def item(self, index: int) -> Optional[_T]: ...
|
||||
def item(self, index: int) -> _T | None: ...
|
||||
|
||||
class EmptyNodeList(Tuple[Any, ...]):
|
||||
length: int
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
import xml.dom
|
||||
from typing import IO, Any, Optional, Text as _Text, TypeVar, Union
|
||||
from typing import IO, Any, Text as _Text, TypeVar
|
||||
from xml.dom.xmlbuilder import DocumentLS, DOMImplementationLS
|
||||
from xml.sax.xmlreader import XMLReader
|
||||
|
||||
_T = TypeVar("_T")
|
||||
|
||||
def parse(file: Union[str, IO[Any]], parser: Optional[XMLReader] = ..., bufsize: Optional[int] = ...): ...
|
||||
def parseString(string: Union[bytes, _Text], parser: Optional[XMLReader] = ...): ...
|
||||
def parse(file: str | IO[Any], parser: XMLReader | None = ..., bufsize: int | None = ...): ...
|
||||
def parseString(string: bytes | _Text, parser: XMLReader | None = ...): ...
|
||||
def getDOMImplementation(features=...): ...
|
||||
|
||||
class Node(xml.dom.Node):
|
||||
namespaceURI: Optional[str]
|
||||
namespaceURI: str | None
|
||||
parentNode: Any
|
||||
ownerDocument: Any
|
||||
nextSibling: Any
|
||||
previousSibling: Any
|
||||
prefix: Any
|
||||
def toxml(self, encoding: Optional[Any] = ...): ...
|
||||
def toprettyxml(self, indent: str = ..., newl: str = ..., encoding: Optional[Any] = ...): ...
|
||||
def toxml(self, encoding: Any | None = ...): ...
|
||||
def toprettyxml(self, indent: str = ..., newl: str = ..., encoding: Any | None = ...): ...
|
||||
def hasChildNodes(self) -> bool: ...
|
||||
def insertBefore(self, newChild, refChild): ...
|
||||
def appendChild(self, node): ...
|
||||
@@ -50,14 +50,14 @@ class Attr(Node):
|
||||
attributes: Any
|
||||
specified: bool
|
||||
ownerElement: Any
|
||||
namespaceURI: Optional[str]
|
||||
namespaceURI: str | None
|
||||
childNodes: Any
|
||||
nodeName: Any
|
||||
nodeValue: str
|
||||
value: str
|
||||
prefix: Any
|
||||
def __init__(
|
||||
self, qName: str, namespaceURI: Optional[str] = ..., localName: Optional[Any] = ..., prefix: Optional[Any] = ...
|
||||
self, qName: str, namespaceURI: str | None = ..., localName: Any | None = ..., prefix: Any | None = ...
|
||||
) -> None: ...
|
||||
def unlink(self) -> None: ...
|
||||
|
||||
@@ -70,7 +70,7 @@ class NamedNodeMap:
|
||||
def keys(self): ...
|
||||
def keysNS(self): ...
|
||||
def values(self): ...
|
||||
def get(self, name, value: Optional[Any] = ...): ...
|
||||
def get(self, name, value: Any | None = ...): ...
|
||||
def __len__(self) -> int: ...
|
||||
def __eq__(self, other: Any) -> bool: ...
|
||||
def __ge__(self, other: Any) -> bool: ...
|
||||
@@ -101,11 +101,11 @@ class Element(Node):
|
||||
parentNode: Any
|
||||
tagName: str
|
||||
prefix: Any
|
||||
namespaceURI: Optional[str]
|
||||
namespaceURI: str | None
|
||||
childNodes: Any
|
||||
nextSibling: Any
|
||||
def __init__(
|
||||
self, tagName, namespaceURI: Optional[str] = ..., prefix: Optional[Any] = ..., localName: Optional[Any] = ...
|
||||
self, tagName, namespaceURI: str | None = ..., prefix: Any | None = ..., localName: Any | None = ...
|
||||
) -> None: ...
|
||||
def unlink(self) -> None: ...
|
||||
def getAttribute(self, attname): ...
|
||||
@@ -288,7 +288,5 @@ class Document(Node, DocumentLS):
|
||||
def getElementsByTagNameNS(self, namespaceURI: str, localName): ...
|
||||
def isSupported(self, feature, version): ...
|
||||
def importNode(self, node, deep): ...
|
||||
def writexml(
|
||||
self, writer, indent: str = ..., addindent: str = ..., newl: str = ..., encoding: Optional[Any] = ...
|
||||
) -> None: ...
|
||||
def writexml(self, writer, indent: str = ..., addindent: str = ..., newl: str = ..., encoding: Any | None = ...) -> None: ...
|
||||
def renameNode(self, n, namespaceURI: str, name): ...
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Callable, Optional, Union
|
||||
from typing import Callable
|
||||
from xml.etree.ElementTree import Element
|
||||
|
||||
XINCLUDE: str
|
||||
@@ -7,9 +7,9 @@ XINCLUDE_FALLBACK: str
|
||||
|
||||
class FatalIncludeError(SyntaxError): ...
|
||||
|
||||
def default_loader(href: Union[str, bytes, int], parse: str, encoding: Optional[str] = ...) -> Union[str, Element]: ...
|
||||
def default_loader(href: str | bytes | int, parse: str, encoding: str | None = ...) -> str | Element: ...
|
||||
|
||||
# TODO: loader is of type default_loader ie it takes a callable that has the
|
||||
# same signature as default_loader. But default_loader has a keyword argument
|
||||
# Which can't be represented using Callable...
|
||||
def include(elem: Element, loader: Optional[Callable[..., Union[str, Element]]] = ...) -> None: ...
|
||||
def include(elem: Element, loader: Callable[..., str | Element] | None = ...) -> None: ...
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Callable, Dict, Generator, List, Optional, Pattern, Tuple, TypeVar, Union
|
||||
from typing import Callable, Dict, Generator, List, Pattern, Tuple, TypeVar
|
||||
from xml.etree.ElementTree import Element
|
||||
|
||||
xpath_tokenizer_re: Pattern[str]
|
||||
@@ -7,7 +7,7 @@ _token = Tuple[str, str]
|
||||
_next = Callable[[], _token]
|
||||
_callback = Callable[[_SelectorContext, List[Element]], Generator[Element, None, None]]
|
||||
|
||||
def xpath_tokenizer(pattern: str, namespaces: Optional[Dict[str, str]] = ...) -> Generator[_token, None, None]: ...
|
||||
def xpath_tokenizer(pattern: str, namespaces: Dict[str, str] | None = ...) -> Generator[_token, None, None]: ...
|
||||
def get_parent_map(context: _SelectorContext) -> Dict[Element, Element]: ...
|
||||
def prepare_child(next: _next, token: _token) -> _callback: ...
|
||||
def prepare_star(next: _next, token: _token) -> _callback: ...
|
||||
@@ -19,15 +19,13 @@ def prepare_predicate(next: _next, token: _token) -> _callback: ...
|
||||
ops: Dict[str, Callable[[_next, _token], _callback]]
|
||||
|
||||
class _SelectorContext:
|
||||
parent_map: Optional[Dict[Element, Element]]
|
||||
parent_map: Dict[Element, Element] | None
|
||||
root: Element
|
||||
def __init__(self, root: Element) -> None: ...
|
||||
|
||||
_T = TypeVar("_T")
|
||||
|
||||
def iterfind(elem: Element, path: str, namespaces: Optional[Dict[str, str]] = ...) -> Generator[Element, None, None]: ...
|
||||
def find(elem: Element, path: str, namespaces: Optional[Dict[str, str]] = ...) -> Optional[Element]: ...
|
||||
def findall(elem: Element, path: str, namespaces: Optional[Dict[str, str]] = ...) -> List[Element]: ...
|
||||
def findtext(
|
||||
elem: Element, path: str, default: Optional[_T] = ..., namespaces: Optional[Dict[str, str]] = ...
|
||||
) -> Union[_T, str]: ...
|
||||
def iterfind(elem: Element, path: str, namespaces: Dict[str, str] | None = ...) -> Generator[Element, None, None]: ...
|
||||
def find(elem: Element, path: str, namespaces: Dict[str, str] | None = ...) -> Element | None: ...
|
||||
def findall(elem: Element, path: str, namespaces: Dict[str, str] | None = ...) -> List[Element]: ...
|
||||
def findtext(elem: Element, path: str, default: _T | None = ..., namespaces: Dict[str, str] | None = ...) -> _T | str: ...
|
||||
|
||||
@@ -11,7 +11,6 @@ from typing import (
|
||||
KeysView,
|
||||
List,
|
||||
MutableSequence,
|
||||
Optional,
|
||||
Sequence,
|
||||
Text,
|
||||
Tuple,
|
||||
@@ -55,11 +54,11 @@ _file_or_filename = Union[Text, FileDescriptor, IO[Any]]
|
||||
class Element(MutableSequence[Element]):
|
||||
tag: _str_result_type
|
||||
attrib: Dict[_str_result_type, _str_result_type]
|
||||
text: Optional[_str_result_type]
|
||||
tail: Optional[_str_result_type]
|
||||
text: _str_result_type | None
|
||||
tail: _str_result_type | None
|
||||
def __init__(
|
||||
self,
|
||||
tag: Union[_str_argument_type, Callable[..., Element]],
|
||||
tag: _str_argument_type | Callable[..., Element],
|
||||
attrib: Dict[_str_argument_type, _str_argument_type] = ...,
|
||||
**extra: _str_argument_type,
|
||||
) -> None: ...
|
||||
@@ -67,38 +66,35 @@ class Element(MutableSequence[Element]):
|
||||
def clear(self) -> None: ...
|
||||
def extend(self, __elements: Iterable[Element]) -> None: ...
|
||||
def find(
|
||||
self, path: _str_argument_type, namespaces: Optional[Dict[_str_argument_type, _str_argument_type]] = ...
|
||||
) -> Optional[Element]: ...
|
||||
self, path: _str_argument_type, namespaces: Dict[_str_argument_type, _str_argument_type] | None = ...
|
||||
) -> Element | None: ...
|
||||
def findall(
|
||||
self, path: _str_argument_type, namespaces: Optional[Dict[_str_argument_type, _str_argument_type]] = ...
|
||||
self, path: _str_argument_type, namespaces: Dict[_str_argument_type, _str_argument_type] | None = ...
|
||||
) -> List[Element]: ...
|
||||
@overload
|
||||
def findtext(
|
||||
self,
|
||||
path: _str_argument_type,
|
||||
default: None = ...,
|
||||
namespaces: Optional[Dict[_str_argument_type, _str_argument_type]] = ...,
|
||||
) -> Optional[_str_result_type]: ...
|
||||
self, path: _str_argument_type, default: None = ..., namespaces: Dict[_str_argument_type, _str_argument_type] | None = ...
|
||||
) -> _str_result_type | None: ...
|
||||
@overload
|
||||
def findtext(
|
||||
self, path: _str_argument_type, default: _T, namespaces: Optional[Dict[_str_argument_type, _str_argument_type]] = ...
|
||||
) -> Union[_T, _str_result_type]: ...
|
||||
self, path: _str_argument_type, default: _T, namespaces: Dict[_str_argument_type, _str_argument_type] | None = ...
|
||||
) -> _T | _str_result_type: ...
|
||||
@overload
|
||||
def get(self, key: _str_argument_type, default: None = ...) -> Optional[_str_result_type]: ...
|
||||
def get(self, key: _str_argument_type, default: None = ...) -> _str_result_type | None: ...
|
||||
@overload
|
||||
def get(self, key: _str_argument_type, default: _T) -> Union[_str_result_type, _T]: ...
|
||||
def get(self, key: _str_argument_type, default: _T) -> _str_result_type | _T: ...
|
||||
def insert(self, __index: int, __element: Element) -> None: ...
|
||||
def items(self) -> ItemsView[_str_result_type, _str_result_type]: ...
|
||||
def iter(self, tag: Optional[_str_argument_type] = ...) -> Generator[Element, None, None]: ...
|
||||
def iter(self, tag: _str_argument_type | None = ...) -> Generator[Element, None, None]: ...
|
||||
def iterfind(
|
||||
self, path: _str_argument_type, namespaces: Optional[Dict[_str_argument_type, _str_argument_type]] = ...
|
||||
self, path: _str_argument_type, namespaces: Dict[_str_argument_type, _str_argument_type] | None = ...
|
||||
) -> Generator[Element, None, None]: ...
|
||||
def itertext(self) -> Generator[_str_result_type, None, None]: ...
|
||||
def keys(self) -> KeysView[_str_result_type]: ...
|
||||
def makeelement(self, __tag: _str_argument_type, __attrib: Dict[_str_argument_type, _str_argument_type]) -> Element: ...
|
||||
def remove(self, __subelement: Element) -> None: ...
|
||||
def set(self, __key: _str_argument_type, __value: _str_argument_type) -> None: ...
|
||||
def __delitem__(self, i: Union[int, slice]) -> None: ...
|
||||
def __delitem__(self, i: int | slice) -> None: ...
|
||||
@overload
|
||||
def __getitem__(self, i: int) -> Element: ...
|
||||
@overload
|
||||
@@ -109,7 +105,7 @@ class Element(MutableSequence[Element]):
|
||||
@overload
|
||||
def __setitem__(self, s: slice, o: Iterable[Element]) -> None: ...
|
||||
def getchildren(self) -> List[Element]: ...
|
||||
def getiterator(self, tag: Optional[_str_argument_type] = ...) -> List[Element]: ...
|
||||
def getiterator(self, tag: _str_argument_type | None = ...) -> List[Element]: ...
|
||||
|
||||
def SubElement(
|
||||
parent: Element,
|
||||
@@ -117,66 +113,63 @@ def SubElement(
|
||||
attrib: Dict[_str_argument_type, _str_argument_type] = ...,
|
||||
**extra: _str_argument_type,
|
||||
) -> Element: ...
|
||||
def Comment(text: Optional[_str_argument_type] = ...) -> Element: ...
|
||||
def ProcessingInstruction(target: _str_argument_type, text: Optional[_str_argument_type] = ...) -> Element: ...
|
||||
def Comment(text: _str_argument_type | None = ...) -> Element: ...
|
||||
def ProcessingInstruction(target: _str_argument_type, text: _str_argument_type | None = ...) -> Element: ...
|
||||
|
||||
PI: Callable[..., Element]
|
||||
|
||||
class QName:
|
||||
text: str
|
||||
def __init__(self, text_or_uri: _str_argument_type, tag: Optional[_str_argument_type] = ...) -> None: ...
|
||||
def __init__(self, text_or_uri: _str_argument_type, tag: _str_argument_type | None = ...) -> None: ...
|
||||
|
||||
class ElementTree:
|
||||
def __init__(self, element: Optional[Element] = ..., file: Optional[_file_or_filename] = ...) -> None: ...
|
||||
def __init__(self, element: Element | None = ..., file: _file_or_filename | None = ...) -> None: ...
|
||||
def getroot(self) -> Element: ...
|
||||
def parse(self, source: _file_or_filename, parser: Optional[XMLParser] = ...) -> Element: ...
|
||||
def iter(self, tag: Optional[_str_argument_type] = ...) -> Generator[Element, None, None]: ...
|
||||
def getiterator(self, tag: Optional[_str_argument_type] = ...) -> List[Element]: ...
|
||||
def parse(self, source: _file_or_filename, parser: XMLParser | None = ...) -> Element: ...
|
||||
def iter(self, tag: _str_argument_type | None = ...) -> Generator[Element, None, None]: ...
|
||||
def getiterator(self, tag: _str_argument_type | None = ...) -> List[Element]: ...
|
||||
def find(
|
||||
self, path: _str_argument_type, namespaces: Optional[Dict[_str_argument_type, _str_argument_type]] = ...
|
||||
) -> Optional[Element]: ...
|
||||
self, path: _str_argument_type, namespaces: Dict[_str_argument_type, _str_argument_type] | None = ...
|
||||
) -> Element | None: ...
|
||||
@overload
|
||||
def findtext(
|
||||
self,
|
||||
path: _str_argument_type,
|
||||
default: None = ...,
|
||||
namespaces: Optional[Dict[_str_argument_type, _str_argument_type]] = ...,
|
||||
) -> Optional[_str_result_type]: ...
|
||||
self, path: _str_argument_type, default: None = ..., namespaces: Dict[_str_argument_type, _str_argument_type] | None = ...
|
||||
) -> _str_result_type | None: ...
|
||||
@overload
|
||||
def findtext(
|
||||
self, path: _str_argument_type, default: _T, namespaces: Optional[Dict[_str_argument_type, _str_argument_type]] = ...
|
||||
) -> Union[_T, _str_result_type]: ...
|
||||
self, path: _str_argument_type, default: _T, namespaces: Dict[_str_argument_type, _str_argument_type] | None = ...
|
||||
) -> _T | _str_result_type: ...
|
||||
def findall(
|
||||
self, path: _str_argument_type, namespaces: Optional[Dict[_str_argument_type, _str_argument_type]] = ...
|
||||
self, path: _str_argument_type, namespaces: Dict[_str_argument_type, _str_argument_type] | None = ...
|
||||
) -> List[Element]: ...
|
||||
def iterfind(
|
||||
self, path: _str_argument_type, namespaces: Optional[Dict[_str_argument_type, _str_argument_type]] = ...
|
||||
self, path: _str_argument_type, namespaces: Dict[_str_argument_type, _str_argument_type] | None = ...
|
||||
) -> Generator[Element, None, None]: ...
|
||||
def write(
|
||||
self,
|
||||
file_or_filename: _file_or_filename,
|
||||
encoding: Optional[str] = ...,
|
||||
xml_declaration: Optional[bool] = ...,
|
||||
default_namespace: Optional[_str_argument_type] = ...,
|
||||
method: Optional[str] = ...,
|
||||
encoding: str | None = ...,
|
||||
xml_declaration: bool | None = ...,
|
||||
default_namespace: _str_argument_type | None = ...,
|
||||
method: str | None = ...,
|
||||
) -> None: ...
|
||||
def write_c14n(self, file: _file_or_filename) -> None: ...
|
||||
|
||||
def register_namespace(prefix: _str_argument_type, uri: _str_argument_type) -> None: ...
|
||||
def tostring(element: Element, encoding: Optional[str] = ..., method: Optional[str] = ...) -> bytes: ...
|
||||
def tostringlist(element: Element, encoding: Optional[str] = ..., method: Optional[str] = ...) -> List[bytes]: ...
|
||||
def tostring(element: Element, encoding: str | None = ..., method: str | None = ...) -> bytes: ...
|
||||
def tostringlist(element: Element, encoding: str | None = ..., method: str | None = ...) -> List[bytes]: ...
|
||||
def dump(elem: Element) -> None: ...
|
||||
def parse(source: _file_or_filename, parser: Optional[XMLParser] = ...) -> ElementTree: ...
|
||||
def parse(source: _file_or_filename, parser: XMLParser | None = ...) -> ElementTree: ...
|
||||
def iterparse(
|
||||
source: _file_or_filename, events: Optional[Sequence[str]] = ..., parser: Optional[XMLParser] = ...
|
||||
source: _file_or_filename, events: Sequence[str] | None = ..., parser: XMLParser | None = ...
|
||||
) -> Iterator[Tuple[str, Any]]: ...
|
||||
def XML(text: _parser_input_type, parser: Optional[XMLParser] = ...) -> Element: ...
|
||||
def XMLID(text: _parser_input_type, parser: Optional[XMLParser] = ...) -> Tuple[Element, Dict[_str_result_type, Element]]: ...
|
||||
def XML(text: _parser_input_type, parser: XMLParser | None = ...) -> Element: ...
|
||||
def XMLID(text: _parser_input_type, parser: XMLParser | None = ...) -> Tuple[Element, Dict[_str_result_type, Element]]: ...
|
||||
|
||||
# This is aliased to XML in the source.
|
||||
fromstring = XML
|
||||
|
||||
def fromstringlist(sequence: Sequence[_parser_input_type], parser: Optional[XMLParser] = ...) -> Element: ...
|
||||
def fromstringlist(sequence: Sequence[_parser_input_type], parser: XMLParser | None = ...) -> Element: ...
|
||||
|
||||
# This type is both not precise enough and too precise. The TreeBuilder
|
||||
# requires the elementfactory to accept tag and attrs in its args and produce
|
||||
@@ -190,7 +183,7 @@ def fromstringlist(sequence: Sequence[_parser_input_type], parser: Optional[XMLP
|
||||
_ElementFactory = Callable[[Any, Dict[Any, Any]], Element]
|
||||
|
||||
class TreeBuilder:
|
||||
def __init__(self, element_factory: Optional[_ElementFactory] = ...) -> None: ...
|
||||
def __init__(self, element_factory: _ElementFactory | None = ...) -> None: ...
|
||||
def close(self) -> Element: ...
|
||||
def data(self, __data: _parser_input_type) -> None: ...
|
||||
def start(self, __tag: _parser_input_type, __attrs: Dict[_parser_input_type, _parser_input_type]) -> Element: ...
|
||||
@@ -202,7 +195,7 @@ class XMLParser:
|
||||
# TODO-what is entity used for???
|
||||
entity: Any
|
||||
version: str
|
||||
def __init__(self, html: int = ..., target: Any = ..., encoding: Optional[str] = ...) -> None: ...
|
||||
def __init__(self, html: int = ..., target: Any = ..., encoding: str | None = ...) -> None: ...
|
||||
def doctype(self, __name: str, __pubid: str, __system: str) -> None: ...
|
||||
def close(self) -> Any: ...
|
||||
def feed(self, __data: _parser_input_type) -> None: ...
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
from typing import IO, Any, List, NoReturn, Optional, Text, Union
|
||||
from typing import IO, Any, List, NoReturn, Text
|
||||
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: ...
|
||||
@@ -22,6 +22,6 @@ class SAXReaderNotAvailable(SAXNotSupportedException): ...
|
||||
default_parser_list: List[str]
|
||||
|
||||
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, Text], handler: ContentHandler, errorHandler: Optional[ErrorHandler] = ...) -> None: ...
|
||||
def parse(source: str | IO[str] | IO[bytes], handler: ContentHandler, errorHandler: ErrorHandler = ...) -> None: ...
|
||||
def parseString(string: bytes | Text, 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, Text, Union
|
||||
from typing import Mapping, Text
|
||||
from xml.sax import handler, xmlreader
|
||||
|
||||
def escape(data: Text, entities: Mapping[Text, Text] = ...) -> Text: ...
|
||||
@@ -11,7 +11,7 @@ def quoteattr(data: Text, entities: Mapping[Text, Text] = ...) -> Text: ...
|
||||
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: Text = ...,
|
||||
) -> None: ...
|
||||
def startDocument(self): ...
|
||||
@@ -27,7 +27,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