Big diff: Use new "|" union syntax (#5872)

This commit is contained in:
Akuli
2021-08-08 12:05:21 +03:00
committed by GitHub
parent b9adb7a874
commit ee487304d7
578 changed files with 8080 additions and 8966 deletions

View File

@@ -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: ...

View File

@@ -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

View File

@@ -1,29 +1,27 @@
import sys
import xml.dom
from _typeshed import Self
from typing import IO, Any, Optional, Union
from typing import IO, Any
from xml.dom.xmlbuilder import DocumentLS, DOMImplementationLS
from xml.sax.xmlreader import XMLReader
def parse(file: Union[str, IO[Any]], parser: Optional[XMLReader] = ..., bufsize: Optional[int] = ...): ...
def parseString(string: Union[str, bytes], parser: Optional[XMLReader] = ...): ...
def parse(file: str | IO[Any], parser: XMLReader | None = ..., bufsize: int | None = ...): ...
def parseString(string: str | bytes, 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
if sys.version_info >= (3, 9):
def toxml(self, encoding: Optional[Any] = ..., standalone: Optional[Any] = ...): ...
def toprettyxml(
self, indent: str = ..., newl: str = ..., encoding: Optional[Any] = ..., standalone: Optional[Any] = ...
): ...
def toxml(self, encoding: Any | None = ..., standalone: Any | None = ...): ...
def toprettyxml(self, indent: str = ..., newl: str = ..., encoding: Any | None = ..., standalone: Any | None = ...): ...
else:
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): ...
@@ -56,14 +54,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: ...
@@ -76,7 +74,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: ...
@@ -107,11 +105,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): ...
@@ -301,11 +299,11 @@ class Document(Node, DocumentLS):
indent: str = ...,
addindent: str = ...,
newl: str = ...,
encoding: Optional[Any] = ...,
standalone: Optional[Any] = ...,
encoding: Any | None = ...,
standalone: Any | None = ...,
) -> None: ...
else:
def writexml(
self, writer, indent: str = ..., addindent: str = ..., newl: str = ..., encoding: Optional[Any] = ...
self, writer, indent: str = ..., addindent: str = ..., newl: str = ..., encoding: Any | None = ...
) -> None: ...
def renameNode(self, n, namespaceURI: str, name): ...

View File

@@ -1,4 +1,4 @@
from typing import IO, Any, Optional
from typing import IO, Any
from xml.sax.handler import ContentHandler
from xml.sax.xmlreader import XMLReader
@@ -12,14 +12,14 @@ IGNORABLE_WHITESPACE: str
CHARACTERS: str
class PullDOM(ContentHandler):
document: Optional[Any]
document: Any | None
documentFactory: Any
firstEvent: Any
lastEvent: Any
elementStack: Any
push: Any
pending_events: Any
def __init__(self, documentFactory: Optional[Any] = ...) -> None: ...
def __init__(self, documentFactory: Any | None = ...) -> None: ...
def pop(self): ...
def setDocumentLocator(self, locator) -> None: ...
def startPrefixMapping(self, prefix, uri) -> None: ...
@@ -65,7 +65,5 @@ class SAX2DOM(PullDOM):
default_bufsize: int
def parse(
stream_or_string: str | IO[bytes], parser: Optional[XMLReader] = ..., bufsize: Optional[int] = ...
) -> DOMEventStream: ...
def parseString(string: str, parser: Optional[XMLReader] = ...) -> DOMEventStream: ...
def parse(stream_or_string: str | IO[bytes], parser: XMLReader | None = ..., bufsize: int | None = ...) -> DOMEventStream: ...
def parseString(string: str, parser: XMLReader | None = ...) -> DOMEventStream: ...