mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-23 12:21:27 +08:00
Use PEP 604 syntax wherever possible (#7493)
This commit is contained in:
@@ -12,10 +12,10 @@ from _typeshed import (
|
||||
from abc import ABCMeta, abstractmethod
|
||||
from importlib.machinery import ModuleSpec
|
||||
from io import BufferedRandom, BufferedReader, BufferedWriter, FileIO, TextIOWrapper
|
||||
from typing import IO, Any, BinaryIO, Iterator, Mapping, NoReturn, Protocol, Sequence, Union, overload, runtime_checkable
|
||||
from typing import IO, Any, BinaryIO, Iterator, Mapping, NoReturn, Protocol, Sequence, overload, runtime_checkable
|
||||
from typing_extensions import Literal
|
||||
|
||||
_Path = Union[bytes, str]
|
||||
_Path = bytes | str
|
||||
|
||||
class Finder(metaclass=ABCMeta): ...
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import sys
|
||||
from contextlib import AbstractContextManager
|
||||
from pathlib import Path
|
||||
from types import ModuleType
|
||||
from typing import Any, BinaryIO, Iterator, TextIO, Union
|
||||
from typing import Any, BinaryIO, Iterator, TextIO
|
||||
|
||||
if sys.version_info >= (3, 10):
|
||||
__all__ = [
|
||||
@@ -37,8 +37,8 @@ elif sys.version_info >= (3, 9):
|
||||
else:
|
||||
__all__ = ["Package", "Resource", "contents", "is_resource", "open_binary", "open_text", "path", "read_binary", "read_text"]
|
||||
|
||||
Package = Union[str, ModuleType]
|
||||
Resource = Union[str, os.PathLike[Any]]
|
||||
Package = str | ModuleType
|
||||
Resource = str | os.PathLike[Any]
|
||||
|
||||
def open_binary(package: Package, resource: Resource) -> BinaryIO: ...
|
||||
def open_text(package: Package, resource: Resource, encoding: str = ..., errors: str = ...) -> TextIO: ...
|
||||
|
||||
Reference in New Issue
Block a user