Big diff: use lower-case list and dict (#5888)

This commit is contained in:
Akuli
2021-08-08 19:26:35 +03:00
committed by GitHub
parent 11f54c3407
commit ce11072dbe
325 changed files with 2196 additions and 2334 deletions

View File

@@ -1,11 +1,11 @@
from typing import Any, Callable, List, Optional, Tuple, Union
from typing import Any, Callable, Optional, Tuple, Union
_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]
) -> List[str]: ...
def gen_preprocess_options(macros: List[_Macro], include_dirs: List[str]) -> List[str]: ...
compiler: CCompiler, library_dirs: list[str], runtime_library_dirs: list[str], libraries: list[str]
) -> list[str]: ...
def gen_preprocess_options(macros: list[_Macro], include_dirs: list[str]) -> list[str]: ...
def get_default_compiler(osname: str | None = ..., platform: str | None = ...) -> str: ...
def new_compiler(
plat: str | None = ..., compiler: str | None = ..., verbose: int = ..., dry_run: int = ..., force: int = ...
@@ -17,34 +17,34 @@ class CCompiler:
force: bool
verbose: bool
output_dir: str | None
macros: List[_Macro]
include_dirs: List[str]
libraries: List[str]
library_dirs: List[str]
runtime_library_dirs: List[str]
objects: List[str]
macros: list[_Macro]
include_dirs: list[str]
libraries: list[str]
library_dirs: list[str]
runtime_library_dirs: list[str]
objects: list[str]
def __init__(self, verbose: int = ..., dry_run: int = ..., force: int = ...) -> None: ...
def add_include_dir(self, dir: str) -> None: ...
def set_include_dirs(self, dirs: List[str]) -> None: ...
def set_include_dirs(self, dirs: list[str]) -> None: ...
def add_library(self, libname: str) -> None: ...
def set_libraries(self, libnames: List[str]) -> None: ...
def set_libraries(self, libnames: list[str]) -> None: ...
def add_library_dir(self, dir: str) -> None: ...
def set_library_dirs(self, dirs: List[str]) -> None: ...
def set_library_dirs(self, dirs: list[str]) -> None: ...
def add_runtime_library_dir(self, dir: str) -> None: ...
def set_runtime_library_dirs(self, dirs: List[str]) -> None: ...
def set_runtime_library_dirs(self, dirs: list[str]) -> None: ...
def define_macro(self, name: str, value: str | None = ...) -> None: ...
def undefine_macro(self, name: str) -> None: ...
def add_link_object(self, object: str) -> None: ...
def set_link_objects(self, objects: List[str]) -> None: ...
def detect_language(self, sources: str | List[str]) -> str | None: ...
def find_library_file(self, dirs: List[str], lib: str, debug: bool = ...) -> str | None: ...
def set_link_objects(self, objects: list[str]) -> None: ...
def detect_language(self, sources: str | list[str]) -> str | None: ...
def find_library_file(self, dirs: list[str], lib: str, debug: bool = ...) -> str | None: ...
def has_function(
self,
funcname: str,
includes: List[str] | None = ...,
include_dirs: List[str] | None = ...,
libraries: List[str] | None = ...,
library_dirs: List[str] | None = ...,
includes: list[str] | None = ...,
include_dirs: list[str] | None = ...,
libraries: list[str] | None = ...,
library_dirs: list[str] | None = ...,
) -> bool: ...
def library_dir_option(self, dir: str) -> str: ...
def library_option(self, lib: str) -> str: ...
@@ -52,18 +52,18 @@ class CCompiler:
def set_executables(self, **args: str) -> None: ...
def compile(
self,
sources: List[str],
sources: list[str],
output_dir: str | None = ...,
macros: _Macro | None = ...,
include_dirs: List[str] | None = ...,
include_dirs: list[str] | None = ...,
debug: bool = ...,
extra_preargs: List[str] | None = ...,
extra_postargs: List[str] | None = ...,
depends: List[str] | None = ...,
) -> List[str]: ...
extra_preargs: list[str] | None = ...,
extra_postargs: list[str] | None = ...,
depends: list[str] | None = ...,
) -> list[str]: ...
def create_static_lib(
self,
objects: List[str],
objects: list[str],
output_libname: str,
output_dir: str | None = ...,
debug: bool = ...,
@@ -72,59 +72,59 @@ class CCompiler:
def link(
self,
target_desc: str,
objects: List[str],
objects: list[str],
output_filename: str,
output_dir: str | None = ...,
libraries: List[str] | None = ...,
library_dirs: List[str] | None = ...,
runtime_library_dirs: List[str] | None = ...,
export_symbols: List[str] | None = ...,
libraries: list[str] | None = ...,
library_dirs: list[str] | None = ...,
runtime_library_dirs: list[str] | None = ...,
export_symbols: list[str] | None = ...,
debug: bool = ...,
extra_preargs: List[str] | None = ...,
extra_postargs: List[str] | None = ...,
extra_preargs: list[str] | None = ...,
extra_postargs: list[str] | None = ...,
build_temp: str | None = ...,
target_lang: str | None = ...,
) -> None: ...
def link_executable(
self,
objects: List[str],
objects: list[str],
output_progname: str,
output_dir: str | None = ...,
libraries: List[str] | None = ...,
library_dirs: List[str] | None = ...,
runtime_library_dirs: List[str] | None = ...,
libraries: list[str] | None = ...,
library_dirs: list[str] | None = ...,
runtime_library_dirs: list[str] | None = ...,
debug: bool = ...,
extra_preargs: List[str] | None = ...,
extra_postargs: List[str] | None = ...,
extra_preargs: list[str] | None = ...,
extra_postargs: list[str] | None = ...,
target_lang: str | None = ...,
) -> None: ...
def link_shared_lib(
self,
objects: List[str],
objects: list[str],
output_libname: str,
output_dir: str | None = ...,
libraries: List[str] | None = ...,
library_dirs: List[str] | None = ...,
runtime_library_dirs: List[str] | None = ...,
export_symbols: List[str] | None = ...,
libraries: list[str] | None = ...,
library_dirs: list[str] | None = ...,
runtime_library_dirs: list[str] | None = ...,
export_symbols: list[str] | None = ...,
debug: bool = ...,
extra_preargs: List[str] | None = ...,
extra_postargs: List[str] | None = ...,
extra_preargs: list[str] | None = ...,
extra_postargs: list[str] | None = ...,
build_temp: str | None = ...,
target_lang: str | None = ...,
) -> None: ...
def link_shared_object(
self,
objects: List[str],
objects: list[str],
output_filename: str,
output_dir: str | None = ...,
libraries: List[str] | None = ...,
library_dirs: List[str] | None = ...,
runtime_library_dirs: List[str] | None = ...,
export_symbols: List[str] | None = ...,
libraries: list[str] | None = ...,
library_dirs: list[str] | None = ...,
runtime_library_dirs: list[str] | None = ...,
export_symbols: list[str] | None = ...,
debug: bool = ...,
extra_preargs: List[str] | None = ...,
extra_postargs: List[str] | None = ...,
extra_preargs: list[str] | None = ...,
extra_postargs: list[str] | None = ...,
build_temp: str | None = ...,
target_lang: str | None = ...,
) -> None: ...
@@ -132,17 +132,17 @@ class CCompiler:
self,
source: str,
output_file: str | None = ...,
macros: List[_Macro] | None = ...,
include_dirs: List[str] | None = ...,
extra_preargs: List[str] | None = ...,
extra_postargs: List[str] | None = ...,
macros: list[_Macro] | None = ...,
include_dirs: list[str] | None = ...,
extra_preargs: list[str] | None = ...,
extra_postargs: list[str] | None = ...,
) -> None: ...
def executable_filename(self, basename: str, strip_dir: int = ..., output_dir: str = ...) -> str: ...
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 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 spawn(self, cmd: List[str]) -> 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: ...
def announce(self, msg: str, level: int = ...) -> None: ...

View File

@@ -1,9 +1,9 @@
from abc import abstractmethod
from distutils.dist import Distribution
from typing import Any, Callable, Iterable, List, Tuple
from typing import Any, Callable, Iterable, Tuple
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: ...
@@ -14,7 +14,7 @@ class Command:
def announce(self, msg: str, level: int = ...) -> None: ...
def debug_print(self, msg: str) -> None: ...
def ensure_string(self, option: str, default: str | None = ...) -> None: ...
def ensure_string_list(self, option: str | List[str]) -> None: ...
def ensure_string_list(self, option: str | list[str]) -> None: ...
def ensure_filename(self, option: str) -> None: ...
def ensure_dirname(self, option: str) -> None: ...
def get_command_name(self) -> str: ...
@@ -22,7 +22,7 @@ class Command:
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: ...
def get_sub_commands(self) -> List[str]: ...
def get_sub_commands(self) -> list[str]: ...
def warn(self, msg: str) -> None: ...
def execute(self, func: Callable[..., Any], args: Iterable[Any], msg: str | None = ..., level: int = ...) -> None: ...
def mkpath(self, name: str, mode: int = ...) -> None: ...
@@ -43,7 +43,7 @@ class Command:
preserve_times: int = ...,
preserve_symlinks: int = ...,
level: Any = ...,
) -> List[str]: ... # level is not used
) -> list[str]: ... # level is not used
def move_file(self, src: str, dst: str, level: Any = ...) -> str: ... # level is not used
def spawn(self, cmd: Iterable[str], search_path: int = ..., level: Any = ...) -> None: ... # level is not used
def make_archive(
@@ -57,10 +57,10 @@ 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],
args: list[Any],
exec_msg: str | None = ...,
skip_msg: str | None = ...,
level: 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, List, Mapping, Tuple, Type
from typing import Any, Mapping, Tuple, Type
def setup(
*,
@@ -15,34 +15,34 @@ def setup(
maintainer_email: str = ...,
url: str = ...,
download_url: str = ...,
packages: List[str] = ...,
py_modules: List[str] = ...,
scripts: List[str] = ...,
ext_modules: List[Extension] = ...,
classifiers: List[str] = ...,
packages: list[str] = ...,
py_modules: list[str] = ...,
scripts: list[str] = ...,
ext_modules: list[Extension] = ...,
classifiers: list[str] = ...,
distclass: Type[Distribution] = ...,
script_name: str = ...,
script_args: List[str] = ...,
script_args: list[str] = ...,
options: Mapping[str, Any] = ...,
license: str = ...,
keywords: List[str] | str = ...,
platforms: List[str] | str = ...,
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] = ...,
obsoletes: list[str] = ...,
provides: list[str] = ...,
requires: list[str] = ...,
command_packages: list[str] = ...,
command_options: Mapping[str, Mapping[str, Tuple[Any, Any]]] = ...,
package_data: Mapping[str, List[str]] = ...,
package_data: Mapping[str, list[str]] = ...,
include_package_data: bool = ...,
libraries: List[str] = ...,
headers: List[str] = ...,
libraries: list[str] = ...,
headers: list[str] = ...,
ext_package: str = ...,
include_dirs: List[str] = ...,
include_dirs: list[str] = ...,
password: str = ...,
fullname: str = ...,
**attrs: Any,
) -> None: ...
def run_setup(script_name: str, script_args: List[str] | None = ..., stop_after: str = ...) -> Distribution: ...
def run_setup(script_name: str, script_args: list[str] | None = ..., stop_after: str = ...) -> Distribution: ...

View File

@@ -1,5 +1,5 @@
from typing import List, Tuple
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_group(sources: List[str], target: str, missing: str = ...) -> bool: ...
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,7 +1,5 @@
from typing import List
def mkpath(name: str, mode: int = ..., verbose: int = ..., dry_run: int = ...) -> List[str]: ...
def create_tree(base_dir: str, files: List[str], mode: int = ..., verbose: int = ..., dry_run: int = ...) -> None: ...
def mkpath(name: str, mode: int = ..., verbose: int = ..., dry_run: int = ...) -> list[str]: ...
def create_tree(base_dir: str, files: list[str], mode: int = ..., verbose: int = ..., dry_run: int = ...) -> None: ...
def copy_tree(
src: str,
dst: str,
@@ -11,5 +9,5 @@ def copy_tree(
update: int = ...,
verbose: int = ...,
dry_run: int = ...,
) -> List[str]: ...
) -> list[str]: ...
def remove_tree(directory: str, verbose: int = ..., dry_run: int = ...) -> None: ...

View File

@@ -1,6 +1,6 @@
from _typeshed import StrOrBytesPath, SupportsWrite
from distutils.cmd import Command
from typing import IO, Any, Dict, Iterable, List, Mapping, Tuple, Type
from typing import IO, Any, Iterable, Mapping, Tuple, Type
class DistributionMetadata:
def __init__(self, path: int | StrOrBytesPath | None = ...) -> None: ...
@@ -14,13 +14,13 @@ class DistributionMetadata:
license: str | None
description: str | None
long_description: str | None
keywords: str | List[str] | None
platforms: str | List[str] | None
classifiers: str | List[str] | None
keywords: str | list[str] | None
platforms: str | list[str] | None
classifiers: str | list[str] | None
download_url: str | None
provides: List[str] | None
requires: List[str] | None
obsoletes: List[str] | None
provides: list[str] | None
requires: list[str] | None
obsoletes: list[str] | None
def read_pkg_file(self, file: IO[str]) -> None: ...
def write_pkg_info(self, base_dir: str) -> None: ...
def write_pkg_file(self, file: SupportsWrite[str]) -> None: ...
@@ -38,21 +38,21 @@ class DistributionMetadata:
def get_licence(self) -> str: ...
def get_description(self) -> str: ...
def get_long_description(self) -> str: ...
def get_keywords(self) -> str | List[str]: ...
def get_platforms(self) -> str | List[str]: ...
def get_classifiers(self) -> str | List[str]: ...
def get_keywords(self) -> str | list[str]: ...
def get_platforms(self) -> str | list[str]: ...
def get_classifiers(self) -> str | list[str]: ...
def get_download_url(self) -> str: ...
def get_requires(self) -> List[str]: ...
def get_requires(self) -> list[str]: ...
def set_requires(self, value: Iterable[str]) -> None: ...
def get_provides(self) -> List[str]: ...
def get_provides(self) -> list[str]: ...
def set_provides(self, value: Iterable[str]) -> None: ...
def get_obsoletes(self) -> List[str]: ...
def get_obsoletes(self) -> list[str]: ...
def set_obsoletes(self, value: Iterable[str]) -> None: ...
class Distribution:
cmdclass: Dict[str, Type[Command]]
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,22 +1,22 @@
from typing import List, Tuple
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 = ...,
undef_macros: List[str] | None = ...,
library_dirs: List[str] | None = ...,
libraries: List[str] | None = ...,
runtime_library_dirs: List[str] | None = ...,
extra_objects: List[str] | None = ...,
extra_compile_args: List[str] | None = ...,
extra_link_args: List[str] | None = ...,
export_symbols: List[str] | None = ...,
sources: list[str],
include_dirs: list[str] | None = ...,
define_macros: list[Tuple[str, str | None]] | None = ...,
undef_macros: list[str] | None = ...,
library_dirs: list[str] | None = ...,
libraries: list[str] | None = ...,
runtime_library_dirs: list[str] | None = ...,
extra_objects: list[str] | None = ...,
extra_compile_args: list[str] | None = ...,
extra_link_args: list[str] | None = ...,
export_symbols: list[str] | None = ...,
swig_opts: str | None = ..., # undocumented
depends: List[str] | None = ...,
depends: list[str] | None = ...,
language: str | None = ...,
optional: bool | None = ...,
) -> None: ...

View File

@@ -4,19 +4,19 @@ _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
) -> List[str] | _GR: ...
def wrap_text(text: str, width: int) -> List[str]: ...
options: list[_Option], negative_opt: Mapping[_Option, _Option], object: Any, args: list[str] | None
) -> list[str] | _GR: ...
def wrap_text(text: str, width: int) -> list[str]: ...
class FancyGetopt:
def __init__(self, option_table: List[_Option] | None = ...) -> None: ...
def __init__(self, option_table: list[_Option] | None = ...) -> None: ...
# TODO kinda wrong, `getopt(object=object())` is invalid
@overload
def getopt(self, args: List[str] | None = ...) -> _GR: ...
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 generate_help(self, header: str | None = ...) -> List[str]: ...
def getopt(self, args: list[str] | None, object: Any) -> list[str]: ...
def get_option_order(self) -> list[Tuple[str, str]]: ...
def generate_help(self, header: str | None = ...) -> list[str]: ...
class OptionDummy:
def __init__(self, options: Iterable[str] = ...) -> None: ...

View File

@@ -1,10 +1,10 @@
from typing import Iterable, List, Pattern, overload
from typing import Iterable, Pattern, overload
from typing_extensions import Literal
# class is entirely undocumented
class FileList:
allfiles: Iterable[str] | None = ...
files: List[str] = ...
files: list[str] = ...
def __init__(self, warn: None = ..., debug_print: None = ...) -> None: ...
def set_allfiles(self, allfiles: Iterable[str]) -> None: ...
def findall(self, dir: str = ...) -> None: ...
@@ -35,7 +35,7 @@ class FileList:
self, pattern: str | Pattern[str], anchor: int | bool = ..., prefix: str | None = ..., is_regex: int | bool = ...
) -> bool: ...
def findall(dir: str = ...) -> List[str]: ...
def findall(dir: str = ...) -> list[str]: ...
def glob_to_re(pattern: str) -> str: ...
@overload
def translate_pattern(

View File

@@ -1,4 +1,2 @@
from typing import List
def spawn(cmd: List[str], search_path: bool = ..., verbose: bool = ..., dry_run: bool = ...) -> None: ...
def spawn(cmd: list[str], search_path: bool = ..., verbose: bool = ..., dry_run: bool = ...) -> None: ...
def find_executable(executable: str, path: str | None = ...) -> str | None: ...

View File

@@ -1,4 +1,4 @@
from typing import IO, List, Tuple
from typing import IO, Tuple
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 readlines(self) -> list[str]: ...
def unreadline(self, line: str) -> str: ...