Use lowercase tuple where possible (#6170)

This commit is contained in:
Akuli
2021-10-15 00:18:19 +00:00
committed by GitHub
parent 5f386b0575
commit 994b69ef8f
242 changed files with 1212 additions and 1224 deletions

View File

@@ -1,9 +1,9 @@
from abc import abstractmethod
from distutils.dist import Distribution
from typing import Any, Callable, Iterable, Tuple
from typing import Any, Callable, Iterable
class Command:
sub_commands: list[Tuple[str, Callable[[Command], bool] | None]]
sub_commands: list[tuple[str, Callable[[Command], bool] | None]]
def __init__(self, dist: Distribution) -> None: ...
@abstractmethod
def initialize_options(self) -> None: ...
@@ -18,7 +18,7 @@ class Command:
def ensure_filename(self, option: str) -> None: ...
def ensure_dirname(self, option: str) -> None: ...
def get_command_name(self) -> str: ...
def set_undefined_options(self, src_cmd: str, *option_pairs: Tuple[str, str]) -> None: ...
def set_undefined_options(self, src_cmd: str, *option_pairs: tuple[str, str]) -> None: ...
def get_finalized_command(self, command: str, create: int = ...) -> Command: ...
def reinitialize_command(self, command: Command | str, reinit_subcommands: int = ...) -> Command: ...
def run_command(self, command: str) -> None: ...
@@ -34,7 +34,7 @@ class Command:
preserve_times: int = ...,
link: str | None = ...,
level: Any = ...,
) -> Tuple[str, bool]: ... # level is not used
) -> tuple[str, bool]: ... # level is not used
def copy_tree(
self,
infile: str,
@@ -57,7 +57,7 @@ class Command:
) -> str: ...
def make_file(
self,
infiles: str | list[str] | Tuple[str],
infiles: str | list[str] | tuple[str],
outfile: str,
func: Callable[..., Any],
args: list[Any],

View File

@@ -1,7 +1,7 @@
from distutils.cmd import Command as Command
from distutils.dist import Distribution as Distribution
from distutils.extension import Extension as Extension
from typing import Any, Mapping, Tuple, Type
from typing import Any, Mapping, Type
def setup(
*,
@@ -28,13 +28,13 @@ def setup(
keywords: list[str] | str = ...,
platforms: list[str] | str = ...,
cmdclass: Mapping[str, Type[Command]] = ...,
data_files: list[Tuple[str, list[str]]] = ...,
data_files: list[tuple[str, list[str]]] = ...,
package_dir: Mapping[str, str] = ...,
obsoletes: list[str] = ...,
provides: list[str] = ...,
requires: list[str] = ...,
command_packages: list[str] = ...,
command_options: Mapping[str, Mapping[str, Tuple[Any, Any]]] = ...,
command_options: Mapping[str, Mapping[str, tuple[Any, Any]]] = ...,
package_data: Mapping[str, list[str]] = ...,
include_package_data: bool = ...,
libraries: list[str] = ...,

View File

@@ -1,5 +1,3 @@
from typing import Tuple
def newer(source: str, target: str) -> bool: ...
def newer_pairwise(sources: list[str], targets: list[str]) -> list[Tuple[str, str]]: ...
def newer_pairwise(sources: list[str], targets: list[str]) -> list[tuple[str, str]]: ...
def newer_group(sources: list[str], target: str, missing: str = ...) -> bool: ...

View File

@@ -1,6 +1,6 @@
from _typeshed import StrOrBytesPath, SupportsWrite
from distutils.cmd import Command
from typing import IO, Any, Iterable, Mapping, Tuple, Type
from typing import IO, Any, Iterable, Mapping, Type
class DistributionMetadata:
def __init__(self, path: int | StrOrBytesPath | None = ...) -> None: ...
@@ -53,6 +53,6 @@ class Distribution:
cmdclass: dict[str, Type[Command]]
metadata: DistributionMetadata
def __init__(self, attrs: Mapping[str, Any] | None = ...) -> None: ...
def get_option_dict(self, command: str) -> dict[str, Tuple[str, str]]: ...
def get_option_dict(self, command: str) -> dict[str, tuple[str, str]]: ...
def parse_config_files(self, filenames: Iterable[str] | None = ...) -> None: ...
def get_command_obj(self, command: str, create: bool = ...) -> Command | None: ...

View File

@@ -1,12 +1,10 @@
from typing import Tuple
class Extension:
def __init__(
self,
name: str,
sources: list[str],
include_dirs: list[str] | None = ...,
define_macros: list[Tuple[str, str | None]] | None = ...,
define_macros: list[tuple[str, str | None]] | None = ...,
undef_macros: list[str] | None = ...,
library_dirs: list[str] | None = ...,
libraries: list[str] | None = ...,

View File

@@ -15,7 +15,7 @@ class FancyGetopt:
def getopt(self, args: list[str] | None = ...) -> _GR: ...
@overload
def getopt(self, args: list[str] | None, object: Any) -> list[str]: ...
def get_option_order(self) -> list[Tuple[str, str]]: ...
def get_option_order(self) -> list[tuple[str, str]]: ...
def generate_help(self, header: str | None = ...) -> list[str]: ...
class OptionDummy:

View File

@@ -1,4 +1,4 @@
from typing import Sequence, Tuple
from typing import Sequence
def copy_file(
src: str,
@@ -9,6 +9,6 @@ def copy_file(
link: str | None = ...,
verbose: bool = ...,
dry_run: bool = ...,
) -> Tuple[str, str]: ...
) -> tuple[str, str]: ...
def move_file(src: str, dst: str, verbose: bool = ..., dry_run: bool = ...) -> str: ...
def write_file(filename: str, contents: Sequence[str]) -> None: ...

View File

@@ -1,4 +1,4 @@
from typing import IO, Tuple
from typing import IO
class TextFile:
def __init__(
@@ -15,7 +15,7 @@ class TextFile:
) -> None: ...
def open(self, filename: str) -> None: ...
def close(self) -> None: ...
def warn(self, msg: str, line: list[int] | Tuple[int, int] | int | None = ...) -> None: ...
def warn(self, msg: str, line: list[int] | tuple[int, int] | int | None = ...) -> None: ...
def readline(self) -> str | None: ...
def readlines(self) -> list[str]: ...
def unreadline(self, line: str) -> str: ...

View File

@@ -21,8 +21,8 @@ class Version:
class StrictVersion(Version):
version_re: Pattern[str]
version: Tuple[int, int, int]
prerelease: Tuple[str, int] | None
version: tuple[int, int, int]
prerelease: tuple[str, int] | None
def __init__(self, vstring: str | None = ...) -> None: ...
def parse(self: _T, vstring: str) -> _T: ...
def __str__(self) -> str: ...