Use PEP 604 syntax wherever possible (#7493)

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

No files matched your search

+2 -2
View File
@@ -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 -3
View File
@@ -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: ...