Switch to PEP-604 syntax in python2 stubs (#5915)

Signed-off-by: oleg.hoefling <oleg.hoefling@gmail.com>
This commit is contained in:
Oleg Höfling
2021-08-14 11:12:30 +02:00
committed by GitHub
parent 431c4f7fc1
commit ff63953188
235 changed files with 2473 additions and 2768 deletions

View File

@@ -1,12 +1,5 @@
from typing import Optional
def make_archive(
base_name: str,
format: str,
root_dir: Optional[str] = ...,
base_dir: Optional[str] = ...,
verbose: int = ...,
dry_run: int = ...,
base_name: str, format: str, root_dir: str | None = ..., base_dir: str | None = ..., verbose: int = ..., dry_run: int = ...
) -> str: ...
def make_tarball(base_name: str, base_dir: str, compress: Optional[str] = ..., verbose: int = ..., dry_run: int = ...) -> str: ...
def make_tarball(base_name: str, base_dir: str, compress: str | None = ..., verbose: int = ..., dry_run: int = ...) -> str: ...
def make_zipfile(base_name: str, base_dir: str, verbose: int = ..., dry_run: int = ...) -> str: ...

View File

@@ -6,9 +6,9 @@ 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]: ...
def get_default_compiler(osname: Optional[str] = ..., platform: Optional[str] = ...) -> str: ...
def get_default_compiler(osname: str | None = ..., platform: str | None = ...) -> str: ...
def new_compiler(
plat: Optional[str] = ..., compiler: Optional[str] = ..., verbose: int = ..., dry_run: int = ..., force: int = ...
plat: str | None = ..., compiler: str | None = ..., verbose: int = ..., dry_run: int = ..., force: int = ...
) -> CCompiler: ...
def show_compilers() -> None: ...
@@ -16,7 +16,7 @@ class CCompiler:
dry_run: bool
force: bool
verbose: bool
output_dir: Optional[str]
output_dir: str | None
macros: List[_Macro]
include_dirs: List[str]
libraries: List[str]
@@ -32,19 +32,19 @@ class CCompiler:
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 define_macro(self, name: str, value: Optional[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: Union[str, List[str]]) -> Optional[str]: ...
def find_library_file(self, dirs: List[str], lib: str, debug: bool = ...) -> Optional[str]: ...
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: Optional[List[str]] = ...,
include_dirs: Optional[List[str]] = ...,
libraries: Optional[List[str]] = ...,
library_dirs: Optional[List[str]] = ...,
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: ...
@@ -53,95 +53,95 @@ class CCompiler:
def compile(
self,
sources: List[str],
output_dir: Optional[str] = ...,
macros: Optional[_Macro] = ...,
include_dirs: Optional[List[str]] = ...,
output_dir: str | None = ...,
macros: _Macro | None = ...,
include_dirs: List[str] | None = ...,
debug: bool = ...,
extra_preargs: Optional[List[str]] = ...,
extra_postargs: Optional[List[str]] = ...,
depends: Optional[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],
output_libname: str,
output_dir: Optional[str] = ...,
output_dir: str | None = ...,
debug: bool = ...,
target_lang: Optional[str] = ...,
target_lang: str | None = ...,
) -> None: ...
def link(
self,
target_desc: str,
objects: List[str],
output_filename: str,
output_dir: Optional[str] = ...,
libraries: Optional[List[str]] = ...,
library_dirs: Optional[List[str]] = ...,
runtime_library_dirs: Optional[List[str]] = ...,
export_symbols: Optional[List[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 = ...,
debug: bool = ...,
extra_preargs: Optional[List[str]] = ...,
extra_postargs: Optional[List[str]] = ...,
build_temp: Optional[str] = ...,
target_lang: Optional[str] = ...,
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],
output_progname: str,
output_dir: Optional[str] = ...,
libraries: Optional[List[str]] = ...,
library_dirs: Optional[List[str]] = ...,
runtime_library_dirs: Optional[List[str]] = ...,
output_dir: str | None = ...,
libraries: List[str] | None = ...,
library_dirs: List[str] | None = ...,
runtime_library_dirs: List[str] | None = ...,
debug: bool = ...,
extra_preargs: Optional[List[str]] = ...,
extra_postargs: Optional[List[str]] = ...,
target_lang: Optional[str] = ...,
extra_preargs: List[str] | None = ...,
extra_postargs: List[str] | None = ...,
target_lang: str | None = ...,
) -> None: ...
def link_shared_lib(
self,
objects: List[str],
output_libname: str,
output_dir: Optional[str] = ...,
libraries: Optional[List[str]] = ...,
library_dirs: Optional[List[str]] = ...,
runtime_library_dirs: Optional[List[str]] = ...,
export_symbols: Optional[List[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 = ...,
debug: bool = ...,
extra_preargs: Optional[List[str]] = ...,
extra_postargs: Optional[List[str]] = ...,
build_temp: Optional[str] = ...,
target_lang: Optional[str] = ...,
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],
output_filename: str,
output_dir: Optional[str] = ...,
libraries: Optional[List[str]] = ...,
library_dirs: Optional[List[str]] = ...,
runtime_library_dirs: Optional[List[str]] = ...,
export_symbols: Optional[List[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 = ...,
debug: bool = ...,
extra_preargs: Optional[List[str]] = ...,
extra_postargs: Optional[List[str]] = ...,
build_temp: Optional[str] = ...,
target_lang: Optional[str] = ...,
extra_preargs: List[str] | None = ...,
extra_postargs: List[str] | None = ...,
build_temp: str | None = ...,
target_lang: str | None = ...,
) -> None: ...
def preprocess(
self,
source: str,
output_file: Optional[str] = ...,
macros: Optional[List[_Macro]] = ...,
include_dirs: Optional[List[str]] = ...,
extra_preargs: Optional[List[str]] = ...,
extra_postargs: Optional[List[str]] = ...,
output_file: 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 shared_object_filename(self, basename: str, strip_dir: int = ..., output_dir: str = ...) -> str: ...
def execute(self, func: Callable[..., None], args: Tuple[Any, ...], msg: Optional[str] = ..., 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 abc import abstractmethod
from distutils.dist import Distribution
from typing import Any, Callable, Iterable, List, Optional, Text, Tuple, Union
from typing import Any, Callable, Iterable, List, Text, Tuple
class Command:
sub_commands: List[Tuple[str, Optional[Callable[[Command], bool]]]]
sub_commands: List[Tuple[str, Callable[[Command], bool] | None]]
def __init__(self, dist: Distribution) -> None: ...
@abstractmethod
def initialize_options(self) -> None: ...
@@ -13,18 +13,18 @@ class Command:
def run(self) -> None: ...
def announce(self, msg: Text, level: int = ...) -> None: ...
def debug_print(self, msg: Text) -> None: ...
def ensure_string(self, option: str, default: Optional[str] = ...) -> None: ...
def ensure_string_list(self, option: Union[str, List[str]]) -> None: ...
def ensure_string(self, option: str, default: str | None = ...) -> 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: ...
def set_undefined_options(self, src_cmd: Text, *option_pairs: Tuple[str, str]) -> None: ...
def get_finalized_command(self, command: Text, create: int = ...) -> Command: ...
def reinitialize_command(self, command: Union[Command, Text], reinit_subcommands: int = ...) -> Command: ...
def reinitialize_command(self, command: Command | Text, reinit_subcommands: int = ...) -> Command: ...
def run_command(self, command: Text) -> None: ...
def get_sub_commands(self) -> List[str]: ...
def warn(self, msg: Text) -> None: ...
def execute(self, func: Callable[..., Any], args: Iterable[Any], msg: Optional[Text] = ..., level: int = ...) -> None: ...
def execute(self, func: Callable[..., Any], args: Iterable[Any], msg: Text | None = ..., level: int = ...) -> None: ...
def mkpath(self, name: str, mode: int = ...) -> None: ...
def copy_file(
self,
@@ -32,7 +32,7 @@ class Command:
outfile: str,
preserve_mode: int = ...,
preserve_times: int = ...,
link: Optional[str] = ...,
link: str | None = ...,
level: Any = ...,
) -> Tuple[str, bool]: ... # level is not used
def copy_tree(
@@ -50,18 +50,18 @@ class Command:
self,
base_name: str,
format: str,
root_dir: Optional[str] = ...,
base_dir: Optional[str] = ...,
owner: Optional[str] = ...,
group: Optional[str] = ...,
root_dir: str | None = ...,
base_dir: str | None = ...,
owner: str | None = ...,
group: str | None = ...,
) -> str: ...
def make_file(
self,
infiles: Union[str, List[str], Tuple[str]],
infiles: str | List[str] | Tuple[str],
outfile: str,
func: Callable[..., Any],
args: List[Any],
exec_msg: Optional[str] = ...,
skip_msg: Optional[str] = ...,
exec_msg: str | None = ...,
skip_msg: str | None = ...,
level: Any = ...,
) -> None: ... # level is not used

View File

@@ -3,19 +3,19 @@ from distutils.ccompiler import CCompiler
from distutils.core import Command as Command
from distutils.errors import DistutilsExecError as DistutilsExecError
from distutils.sysconfig import customize_compiler as customize_compiler
from typing import Dict, List, Optional, Pattern, Sequence, Tuple, Union
from typing import Dict, List, Pattern, Sequence, Tuple
LANG_EXT: Dict[str, str]
class config(Command):
description: str = ...
# Tuple is full name, short name, description
user_options: Sequence[Tuple[str, Optional[str], str]] = ...
compiler: Optional[Union[str, CCompiler]] = ...
cc: Optional[str] = ...
include_dirs: Optional[Sequence[str]] = ...
libraries: Optional[Sequence[str]] = ...
library_dirs: Optional[Sequence[str]] = ...
user_options: Sequence[Tuple[str, str | None, str]] = ...
compiler: str | CCompiler | None = ...
cc: str | None = ...
include_dirs: Sequence[str] | None = ...
libraries: Sequence[str] | None = ...
library_dirs: Sequence[str] | None = ...
noisy: int = ...
dump_source: int = ...
temp_files: Sequence[str] = ...
@@ -24,64 +24,60 @@ class config(Command):
def run(self) -> None: ...
def try_cpp(
self,
body: Optional[str] = ...,
headers: Optional[Sequence[str]] = ...,
include_dirs: Optional[Sequence[str]] = ...,
body: str | None = ...,
headers: Sequence[str] | None = ...,
include_dirs: Sequence[str] | None = ...,
lang: str = ...,
) -> bool: ...
def search_cpp(
self,
pattern: Union[Pattern[str], str],
body: Optional[str] = ...,
headers: Optional[Sequence[str]] = ...,
include_dirs: Optional[Sequence[str]] = ...,
pattern: Pattern[str] | str,
body: str | None = ...,
headers: Sequence[str] | None = ...,
include_dirs: Sequence[str] | None = ...,
lang: str = ...,
) -> bool: ...
def try_compile(
self, body: str, headers: Optional[Sequence[str]] = ..., include_dirs: Optional[Sequence[str]] = ..., lang: str = ...
self, body: str, headers: Sequence[str] | None = ..., include_dirs: Sequence[str] | None = ..., lang: str = ...
) -> bool: ...
def try_link(
self,
body: str,
headers: Optional[Sequence[str]] = ...,
include_dirs: Optional[Sequence[str]] = ...,
libraries: Optional[Sequence[str]] = ...,
library_dirs: Optional[Sequence[str]] = ...,
headers: Sequence[str] | None = ...,
include_dirs: Sequence[str] | None = ...,
libraries: Sequence[str] | None = ...,
library_dirs: Sequence[str] | None = ...,
lang: str = ...,
) -> bool: ...
def try_run(
self,
body: str,
headers: Optional[Sequence[str]] = ...,
include_dirs: Optional[Sequence[str]] = ...,
libraries: Optional[Sequence[str]] = ...,
library_dirs: Optional[Sequence[str]] = ...,
headers: Sequence[str] | None = ...,
include_dirs: Sequence[str] | None = ...,
libraries: Sequence[str] | None = ...,
library_dirs: Sequence[str] | None = ...,
lang: str = ...,
) -> bool: ...
def check_func(
self,
func: str,
headers: Optional[Sequence[str]] = ...,
include_dirs: Optional[Sequence[str]] = ...,
libraries: Optional[Sequence[str]] = ...,
library_dirs: Optional[Sequence[str]] = ...,
headers: Sequence[str] | None = ...,
include_dirs: Sequence[str] | None = ...,
libraries: Sequence[str] | None = ...,
library_dirs: Sequence[str] | None = ...,
decl: int = ...,
call: int = ...,
) -> bool: ...
def check_lib(
self,
library: str,
library_dirs: Optional[Sequence[str]] = ...,
headers: Optional[Sequence[str]] = ...,
include_dirs: Optional[Sequence[str]] = ...,
library_dirs: Sequence[str] | None = ...,
headers: Sequence[str] | None = ...,
include_dirs: Sequence[str] | None = ...,
other_libraries: List[str] = ...,
) -> bool: ...
def check_header(
self,
header: str,
include_dirs: Optional[Sequence[str]] = ...,
library_dirs: Optional[Sequence[str]] = ...,
lang: str = ...,
self, header: str, include_dirs: Sequence[str] | None = ..., library_dirs: Sequence[str] | None = ..., lang: str = ...
) -> bool: ...
def dump_file(filename: str, head: Optional[str] = ...) -> None: ...
def dump_file(filename: str, head: str | None = ...) -> None: ...

View File

@@ -1,12 +1,12 @@
from distutils.cmd import Command
from typing import Optional, Text
from typing import Text
class install(Command):
user: bool
prefix: Optional[Text]
home: Optional[Text]
root: Optional[Text]
install_lib: Optional[Text]
prefix: Text | None
home: Text | None
root: Text | None
install_lib: Text | None
def initialize_options(self) -> None: ...
def finalize_options(self) -> None: ...
def run(self) -> None: ...

View File

@@ -1,9 +1,9 @@
from distutils.cmd import Command
from typing import ClassVar, List, Optional, Tuple
from typing import ClassVar, List, Tuple
class install_egg_info(Command):
description: ClassVar[str]
user_options: ClassVar[List[Tuple[str, Optional[str], str]]]
user_options: ClassVar[List[Tuple[str, str | None, str]]]
def initialize_options(self) -> None: ...
def finalize_options(self) -> None: ...
def run(self) -> None: ...

View File

@@ -1,5 +1,5 @@
from distutils.config import PyPIRCCommand
from typing import ClassVar, List, Optional, Tuple
from typing import ClassVar, List, Tuple
class upload(PyPIRCCommand):
description: ClassVar[str]

View File

@@ -1,6 +1,6 @@
from abc import abstractmethod
from distutils.cmd import Command
from typing import ClassVar, List, Optional, Tuple
from typing import ClassVar, List, Tuple
DEFAULT_PYPIRC: str
@@ -9,7 +9,7 @@ class PyPIRCCommand(Command):
DEFAULT_REALM: ClassVar[str]
repository: None
realm: None
user_options: ClassVar[List[Tuple[str, Optional[str], str]]]
user_options: ClassVar[List[Tuple[str, str | None, str]]]
boolean_options: ClassVar[List[str]]
def initialize_options(self) -> None: ...
def finalize_options(self) -> None: ...

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, Optional, Tuple, Type, Union
from typing import Any, List, Mapping, Tuple, Type
def setup(
*,
@@ -25,8 +25,8 @@ def setup(
script_args: List[str] = ...,
options: Mapping[str, Any] = ...,
license: str = ...,
keywords: Union[List[str], str] = ...,
platforms: Union[List[str], str] = ...,
keywords: List[str] | str = ...,
platforms: List[str] | str = ...,
cmdclass: Mapping[str, Type[Command]] = ...,
data_files: List[Tuple[str, List[str]]] = ...,
package_dir: Mapping[str, str] = ...,
@@ -45,4 +45,4 @@ def setup(
fullname: str = ...,
**attrs: Any,
) -> None: ...
def run_setup(script_name: str, script_args: Optional[List[str]] = ..., stop_after: str = ...) -> Distribution: ...
def run_setup(script_name: str, script_args: List[str] | None = ..., stop_after: str = ...) -> Distribution: ...

View File

@@ -1,9 +1,9 @@
from distutils.cmd import Command
from typing import Any, Dict, Iterable, Mapping, Optional, Text, Tuple, Type
from typing import Any, Dict, Iterable, Mapping, Text, Tuple, Type
class Distribution:
cmdclass: Dict[str, Type[Command]]
def __init__(self, attrs: Optional[Mapping[str, Any]] = ...) -> None: ...
def __init__(self, attrs: Mapping[str, Any] | None = ...) -> None: ...
def get_option_dict(self, command: str) -> Dict[str, Tuple[str, Text]]: ...
def parse_config_files(self, filenames: Optional[Iterable[Text]] = ...) -> None: ...
def get_command_obj(self, command: str, create: bool = ...) -> Optional[Command]: ...
def parse_config_files(self, filenames: Iterable[Text] | None = ...) -> None: ...
def get_command_obj(self, command: str, create: bool = ...) -> Command | None: ...

View File

@@ -1,4 +1,4 @@
from typing import List, Optional, Tuple
from typing import List, Tuple
class Extension:
def __init__(
@@ -6,7 +6,7 @@ class Extension:
name: str,
sources: List[str],
include_dirs: List[str] = ...,
define_macros: List[Tuple[str, Optional[str]]] = ...,
define_macros: List[Tuple[str, str | None]] = ...,
undef_macros: List[str] = ...,
library_dirs: List[str] = ...,
libraries: List[str] = ...,
@@ -15,7 +15,7 @@ class Extension:
extra_compile_args: List[str] = ...,
extra_link_args: List[str] = ...,
export_symbols: List[str] = ...,
swig_opts: Optional[str] = ..., # undocumented
swig_opts: str | None = ..., # undocumented
depends: List[str] = ...,
language: str = ...,
) -> None: ...

View File

@@ -1,21 +1,21 @@
from typing import Any, List, Mapping, Optional, Tuple, Union, overload
from typing import Any, List, Mapping, Optional, Tuple, overload
_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: Optional[List[str]]
) -> Union[List[str], _GR]: ...
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: Optional[List[_Option]] = ...) -> None: ...
def __init__(self, option_table: List[_Option] | None = ...) -> None: ...
# TODO kinda wrong, `getopt(object=object())` is invalid
@overload
def getopt(self, args: Optional[List[str]] = ...) -> _GR: ...
def getopt(self, args: List[str] | None = ...) -> _GR: ...
@overload
def getopt(self, args: Optional[List[str]], object: Any) -> 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: Optional[str] = ...) -> List[str]: ...
def generate_help(self, header: str | None = ...) -> List[str]: ...
class OptionDummy: ...

View File

@@ -1,4 +1,4 @@
from typing import Optional, Sequence, Tuple
from typing import Sequence, Tuple
def copy_file(
src: str,
@@ -6,7 +6,7 @@ def copy_file(
preserve_mode: bool = ...,
preserve_times: bool = ...,
update: bool = ...,
link: Optional[str] = ...,
link: str | None = ...,
verbose: bool = ...,
dry_run: bool = ...,
) -> Tuple[str, str]: ...

View File

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

View File

@@ -1,14 +1,14 @@
from distutils.ccompiler import CCompiler
from typing import Mapping, Optional, Union
from typing import Mapping
PREFIX: str
EXEC_PREFIX: str
def get_config_var(name: str) -> Union[int, str, None]: ...
def get_config_vars(*args: str) -> Mapping[str, Union[int, str]]: ...
def get_config_var(name: str) -> int | str | None: ...
def get_config_vars(*args: str) -> Mapping[str, int | str]: ...
def get_config_h_filename() -> str: ...
def get_makefile_filename() -> str: ...
def get_python_inc(plat_specific: bool = ..., prefix: Optional[str] = ...) -> str: ...
def get_python_lib(plat_specific: bool = ..., standard_lib: bool = ..., prefix: Optional[str] = ...) -> str: ...
def get_python_inc(plat_specific: bool = ..., prefix: str | None = ...) -> str: ...
def get_python_lib(plat_specific: bool = ..., standard_lib: bool = ..., prefix: str | None = ...) -> str: ...
def customize_compiler(compiler: CCompiler) -> None: ...
def set_python_build() -> None: ...

View File

@@ -1,10 +1,10 @@
from typing import IO, List, Optional, Tuple, Union
from typing import IO, List, Tuple
class TextFile:
def __init__(
self,
filename: Optional[str] = ...,
file: Optional[IO[str]] = ...,
filename: str | None = ...,
file: IO[str] | None = ...,
*,
strip_comments: bool = ...,
lstrip_ws: bool = ...,
@@ -15,7 +15,7 @@ class TextFile:
) -> None: ...
def open(self, filename: str) -> None: ...
def close(self) -> None: ...
def warn(self, msg: str, line: Union[List[int], Tuple[int, int], int] = ...) -> None: ...
def readline(self) -> Optional[str]: ...
def warn(self, msg: str, line: List[int] | Tuple[int, int] | int = ...) -> None: ...
def readline(self) -> str | None: ...
def readlines(self) -> List[str]: ...
def unreadline(self, line: str) -> str: ...

View File

@@ -1,4 +1,4 @@
from typing import Any, Callable, List, Mapping, Optional, Tuple
from typing import Any, Callable, List, Mapping, Tuple
def get_platform() -> str: ...
def convert_path(pathname: str) -> str: ...
@@ -7,17 +7,17 @@ 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: Optional[str] = ..., 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(
py_files: List[str],
optimize: int = ...,
force: bool = ...,
prefix: Optional[str] = ...,
base_dir: Optional[str] = ...,
prefix: str | None = ...,
base_dir: str | None = ...,
verbose: bool = ...,
dry_run: bool = ...,
direct: Optional[bool] = ...,
direct: bool | None = ...,
) -> None: ...
def rfc822_escape(header: str) -> str: ...

View File

@@ -1,33 +1,33 @@
from abc import abstractmethod
from typing import Optional, Pattern, Text, Tuple, TypeVar, Union
from typing import Pattern, Text, Tuple, TypeVar
_T = TypeVar("_T", bound=Version)
class Version:
def __repr__(self) -> str: ...
@abstractmethod
def __init__(self, vstring: Optional[Text] = ...) -> None: ...
def __init__(self, vstring: Text | None = ...) -> None: ...
@abstractmethod
def parse(self: _T, vstring: Text) -> _T: ...
@abstractmethod
def __str__(self) -> str: ...
@abstractmethod
def __cmp__(self: _T, other: Union[_T, str]) -> bool: ...
def __cmp__(self: _T, other: _T | str) -> bool: ...
class StrictVersion(Version):
version_re: Pattern[str]
version: Tuple[int, int, int]
prerelease: Optional[Tuple[Text, int]]
def __init__(self, vstring: Optional[Text] = ...) -> None: ...
prerelease: Tuple[Text, int] | None
def __init__(self, vstring: Text | None = ...) -> None: ...
def parse(self: _T, vstring: Text) -> _T: ...
def __str__(self) -> str: ...
def __cmp__(self: _T, other: Union[_T, str]) -> bool: ...
def __cmp__(self: _T, other: _T | str) -> bool: ...
class LooseVersion(Version):
component_re: Pattern[str]
vstring: Text
version: Tuple[Union[Text, int], ...]
def __init__(self, vstring: Optional[Text] = ...) -> None: ...
version: Tuple[Text | int, ...]
def __init__(self, vstring: Text | None = ...) -> None: ...
def parse(self: _T, vstring: Text) -> _T: ...
def __str__(self) -> str: ...
def __cmp__(self: _T, other: Union[_T, str]) -> bool: ...
def __cmp__(self: _T, other: _T | str) -> bool: ...