Use PEP 585 syntax wherever possible (#6717)

This commit is contained in:
Alex Waygood
2021-12-28 10:31:43 +00:00
committed by GitHub
parent e6cb341d94
commit 8d5d2520ac
237 changed files with 966 additions and 1069 deletions

View File

@@ -1,6 +1,6 @@
from typing import Any, Callable, Optional, Tuple, Union
from typing import Any, Callable, Optional, Union
_Macro = Union[Tuple[str], Tuple[str, Optional[str]]]
_Macro = Union[tuple[str], tuple[str, Optional[str]]]
def gen_lib_options(
compiler: CCompiler, library_dirs: list[str], runtime_library_dirs: list[str], libraries: list[str]
@@ -141,7 +141,7 @@ class CCompiler:
def library_filename(self, libname: str, lib_type: str = ..., strip_dir: int = ..., output_dir: str = ...) -> str: ...
def object_filenames(self, source_filenames: list[str], strip_dir: int = ..., output_dir: str = ...) -> list[str]: ...
def shared_object_filename(self, basename: str, strip_dir: int = ..., output_dir: str = ...) -> str: ...
def execute(self, func: Callable[..., None], args: Tuple[Any, ...], msg: str | None = ..., level: int = ...) -> None: ...
def execute(self, func: Callable[..., None], args: tuple[Any, ...], msg: str | None = ..., level: int = ...) -> None: ...
def spawn(self, cmd: list[str]) -> None: ...
def mkpath(self, name: str, mode: int = ...) -> None: ...
def move_file(self, src: str, dst: str) -> str: ...

View File

@@ -1,9 +1,9 @@
from typing import Any, Tuple
from typing import Any
from ..cmd import Command
HAS_USER_SITE: bool
SCHEME_KEYS: Tuple[str, ...]
SCHEME_KEYS: tuple[str, ...]
INSTALL_SCHEMES: dict[str, dict[Any, Any]]
class install(Command):

View File

@@ -1,7 +1,7 @@
from typing import Any, Iterable, List, Mapping, Optional, Tuple, overload
from typing import Any, Iterable, Mapping, Optional, overload
_Option = Tuple[str, Optional[str], str]
_GR = Tuple[List[str], OptionDummy]
_Option = tuple[str, Optional[str], str]
_GR = tuple[list[str], OptionDummy]
def fancy_getopt(
options: list[_Option], negative_opt: Mapping[_Option, _Option], object: Any, args: list[str] | None

View File

@@ -1,6 +1,6 @@
from _typeshed import StrPath
from collections.abc import Callable, Container, Iterable, Mapping
from typing import Any, Tuple
from typing import Any
def get_platform() -> str: ...
def convert_path(pathname: str) -> str: ...
@@ -9,7 +9,7 @@ def check_environ() -> None: ...
def subst_vars(s: str, local_vars: Mapping[str, str]) -> None: ...
def split_quoted(s: str) -> list[str]: ...
def execute(
func: Callable[..., None], args: Tuple[Any, ...], msg: str | None = ..., verbose: bool = ..., dry_run: bool = ...
func: Callable[..., None], args: tuple[Any, ...], msg: str | None = ..., verbose: bool = ..., dry_run: bool = ...
) -> None: ...
def strtobool(val: str) -> bool: ...
def byte_compile(

View File

@@ -1,5 +1,5 @@
from abc import abstractmethod
from typing import Pattern, Tuple, TypeVar
from typing import Pattern, TypeVar
_T = TypeVar("_T", bound=Version)
@@ -31,7 +31,7 @@ class StrictVersion(Version):
class LooseVersion(Version):
component_re: Pattern[str]
vstring: str
version: Tuple[str | int, ...]
version: tuple[str | int, ...]
def __init__(self, vstring: str | None = ...) -> None: ...
def parse(self: _T, vstring: str) -> _T: ...
def __str__(self) -> str: ...