mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-22 20:01:29 +08:00
Use PEP 604 syntax wherever possible (#7493)
This commit is contained in:
@@ -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[
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -12,7 +12,6 @@ from typing import (
|
||||
MutableSequence,
|
||||
Sequence,
|
||||
TypeVar,
|
||||
Union,
|
||||
overload,
|
||||
)
|
||||
from typing_extensions import Literal, SupportsIndex, TypeGuard
|
||||
@@ -102,9 +101,9 @@ else:
|
||||
]
|
||||
|
||||
_T = TypeVar("_T")
|
||||
_FileRead = Union[StrOrBytesPath, FileDescriptor, SupportsRead[bytes], SupportsRead[str]]
|
||||
_FileWriteC14N = Union[StrOrBytesPath, FileDescriptor, SupportsWrite[bytes]]
|
||||
_FileWrite = Union[_FileWriteC14N, SupportsWrite[str]]
|
||||
_FileRead = StrOrBytesPath | FileDescriptor | SupportsRead[bytes] | SupportsRead[str]
|
||||
_FileWriteC14N = StrOrBytesPath | FileDescriptor | SupportsWrite[bytes]
|
||||
_FileWrite = _FileWriteC14N | SupportsWrite[str]
|
||||
|
||||
VERSION: str
|
||||
|
||||
|
||||
Reference in New Issue
Block a user