Use PEP 604 syntax wherever possible (#7493)

This commit is contained in:
Alex Waygood
2022-03-16 15:01:33 +00:00
committed by GitHub
parent 15e21a8dc1
commit 3ab250eec8
174 changed files with 472 additions and 490 deletions

View File

@@ -1,6 +1,6 @@
import sys
from _typeshed import SupportsRead
from typing import Any, Sequence, Union
from typing import Any, Sequence
from typing_extensions import Literal
from xml.dom.minidom import Document, DOMImplementation, Element, Text
from xml.sax.handler import ContentHandler
@@ -15,8 +15,8 @@ PROCESSING_INSTRUCTION: Literal["PROCESSING_INSTRUCTION"]
IGNORABLE_WHITESPACE: Literal["IGNORABLE_WHITESPACE"]
CHARACTERS: Literal["CHARACTERS"]
_DocumentFactory = Union[DOMImplementation, None]
_Node = Union[Document, Element, Text]
_DocumentFactory = DOMImplementation | None
_Node = Document | Element | Text
_Event = tuple[
Literal[

View File

@@ -1,4 +1,4 @@
from typing import Any, NoReturn, Optional
from typing import Any, NoReturn
from typing_extensions import Literal
from urllib.request import OpenerDirector
from xml.dom.expatbuilder import ExpatBuilder, ExpatBuilderNS
@@ -18,13 +18,13 @@ __all__ = ["DOMBuilder", "DOMEntityResolver", "DOMInputSource"]
# probably the same as `Options.errorHandler`?
# Maybe `xml.sax.handler.ErrorHandler`?
_DOMBuilderErrorHandlerType = Optional[Any]
_DOMBuilderErrorHandlerType = Any | None
# probably some kind of IO...
_DOMInputSourceCharacterStreamType = Optional[Any]
_DOMInputSourceCharacterStreamType = Any | None
# probably a string??
_DOMInputSourceStringDataType = Optional[Any]
_DOMInputSourceStringDataType = Any | None
# probably a string??
_DOMInputSourceEncodingType = Optional[Any]
_DOMInputSourceEncodingType = Any | None
class Options:
namespaces: int