Big diff: Use new "|" union syntax (#5872)

This commit is contained in:
Akuli
2021-08-08 12:05:21 +03:00
committed by GitHub
parent b9adb7a874
commit ee487304d7
578 changed files with 8080 additions and 8966 deletions

View File

@@ -1,22 +1,20 @@
from typing import Optional
def make_archive(
base_name: str,
format: str,
root_dir: Optional[str] = ...,
base_dir: Optional[str] = ...,
root_dir: str | None = ...,
base_dir: str | None = ...,
verbose: int = ...,
dry_run: int = ...,
owner: Optional[str] = ...,
group: Optional[str] = ...,
owner: str | None = ...,
group: str | None = ...,
) -> str: ...
def make_tarball(
base_name: str,
base_dir: str,
compress: Optional[str] = ...,
compress: str | None = ...,
verbose: int = ...,
dry_run: int = ...,
owner: Optional[str] = ...,
group: Optional[str] = ...,
owner: str | None = ...,
group: str | None = ...,
) -> 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, Tuple, Union
from typing import Any, Callable, Iterable, List, 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: str, level: int = ...) -> None: ...
def debug_print(self, msg: str) -> 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: str, *option_pairs: Tuple[str, str]) -> None: ...
def get_finalized_command(self, command: str, create: int = ...) -> Command: ...
def reinitialize_command(self, command: Union[Command, str], reinit_subcommands: 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 warn(self, msg: str) -> None: ...
def execute(self, func: Callable[..., Any], args: Iterable[Any], msg: Optional[str] = ..., level: int = ...) -> None: ...
def execute(self, func: Callable[..., Any], args: Iterable[Any], msg: str | 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

@@ -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,3 +1 @@
from typing import Optional
DEBUG: Optional[bool]
DEBUG: bool | None

View File

@@ -1,26 +1,26 @@
from _typeshed import StrOrBytesPath, SupportsWrite
from distutils.cmd import Command
from typing import IO, Any, Dict, Iterable, List, Mapping, Optional, Tuple, Type, Union
from typing import IO, Any, Dict, Iterable, List, Mapping, Tuple, Type
class DistributionMetadata:
def __init__(self, path: Optional[Union[int, StrOrBytesPath]] = ...) -> None: ...
name: Optional[str]
version: Optional[str]
author: Optional[str]
author_email: Optional[str]
maintainer: Optional[str]
maintainer_email: Optional[str]
url: Optional[str]
license: Optional[str]
description: Optional[str]
long_description: Optional[str]
keywords: Optional[Union[str, List[str]]]
platforms: Optional[Union[str, List[str]]]
classifiers: Optional[Union[str, List[str]]]
download_url: Optional[str]
provides: Optional[List[str]]
requires: Optional[List[str]]
obsoletes: Optional[List[str]]
def __init__(self, path: int | StrOrBytesPath | None = ...) -> None: ...
name: str | None
version: str | None
author: str | None
author_email: str | None
maintainer: str | None
maintainer_email: str | None
url: str | None
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
download_url: 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,9 +38,9 @@ class DistributionMetadata:
def get_licence(self) -> str: ...
def get_description(self) -> str: ...
def get_long_description(self) -> str: ...
def get_keywords(self) -> Union[str, List[str]]: ...
def get_platforms(self) -> Union[str, List[str]]: ...
def get_classifiers(self) -> Union[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 set_requires(self, value: Iterable[str]) -> None: ...
@@ -52,7 +52,7 @@ class DistributionMetadata:
class Distribution:
cmdclass: Dict[str, Type[Command]]
metadata: DistributionMetadata
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, str]]: ...
def parse_config_files(self, filenames: Optional[Iterable[str]] = ...) -> None: ...
def get_command_obj(self, command: str, create: bool = ...) -> Optional[Command]: ...
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, Optional, Tuple
from typing import List, Tuple
class Extension:
def __init__(
self,
name: str,
sources: List[str],
include_dirs: Optional[List[str]] = ...,
define_macros: Optional[List[Tuple[str, Optional[str]]]] = ...,
undef_macros: Optional[List[str]] = ...,
library_dirs: Optional[List[str]] = ...,
libraries: Optional[List[str]] = ...,
runtime_library_dirs: Optional[List[str]] = ...,
extra_objects: Optional[List[str]] = ...,
extra_compile_args: Optional[List[str]] = ...,
extra_link_args: Optional[List[str]] = ...,
export_symbols: Optional[List[str]] = ...,
swig_opts: Optional[str] = ..., # undocumented
depends: Optional[List[str]] = ...,
language: Optional[str] = ...,
optional: Optional[bool] = ...,
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 = ...,
language: str | None = ...,
optional: bool | None = ...,
) -> None: ...

View File

@@ -1,22 +1,22 @@
from typing import Any, Iterable, List, Mapping, Optional, Tuple, Union, overload
from typing import Any, Iterable, 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:
def __init__(self, options: Iterable[str] = ...) -> None: ...

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,9 +1,9 @@
from typing import Iterable, List, Optional, Pattern, Union, overload
from typing import Iterable, List, Pattern, overload
from typing_extensions import Literal
# class is entirely undocumented
class FileList:
allfiles: Optional[Iterable[str]] = ...
allfiles: Iterable[str] | None = ...
files: List[str] = ...
def __init__(self, warn: None = ..., debug_print: None = ...) -> None: ...
def set_allfiles(self, allfiles: Iterable[str]) -> None: ...
@@ -16,45 +16,34 @@ class FileList:
def process_template_line(self, line: str) -> None: ...
@overload
def include_pattern(
self, pattern: str, anchor: Union[int, bool] = ..., prefix: Optional[str] = ..., is_regex: Literal[0, False] = ...
self, pattern: str, anchor: int | bool = ..., prefix: str | None = ..., is_regex: Literal[0, False] = ...
) -> bool: ...
@overload
def include_pattern(self, pattern: Union[str, Pattern[str]], *, is_regex: Literal[True, 1] = ...) -> bool: ...
def include_pattern(self, pattern: str | Pattern[str], *, is_regex: Literal[True, 1] = ...) -> bool: ...
@overload
def include_pattern(
self,
pattern: Union[str, Pattern[str]],
anchor: Union[int, bool] = ...,
prefix: Optional[str] = ...,
is_regex: Union[int, bool] = ...,
self, pattern: str | Pattern[str], anchor: int | bool = ..., prefix: str | None = ..., is_regex: int | bool = ...
) -> bool: ...
@overload
def exclude_pattern(
self, pattern: str, anchor: Union[int, bool] = ..., prefix: Optional[str] = ..., is_regex: Literal[0, False] = ...
self, pattern: str, anchor: int | bool = ..., prefix: str | None = ..., is_regex: Literal[0, False] = ...
) -> bool: ...
@overload
def exclude_pattern(self, pattern: Union[str, Pattern[str]], *, is_regex: Literal[True, 1] = ...) -> bool: ...
def exclude_pattern(self, pattern: str | Pattern[str], *, is_regex: Literal[True, 1] = ...) -> bool: ...
@overload
def exclude_pattern(
self,
pattern: Union[str, Pattern[str]],
anchor: Union[int, bool] = ...,
prefix: Optional[str] = ...,
is_regex: Union[int, bool] = ...,
self, pattern: str | Pattern[str], anchor: int | bool = ..., prefix: str | None = ..., is_regex: int | bool = ...
) -> bool: ...
def findall(dir: str = ...) -> List[str]: ...
def glob_to_re(pattern: str) -> str: ...
@overload
def translate_pattern(
pattern: str, anchor: Union[int, bool] = ..., prefix: Optional[str] = ..., is_regex: Literal[False, 0] = ...
pattern: str, anchor: int | bool = ..., prefix: str | None = ..., is_regex: Literal[False, 0] = ...
) -> Pattern[str]: ...
@overload
def translate_pattern(pattern: Union[str, Pattern[str]], *, is_regex: Literal[True, 1] = ...) -> Pattern[str]: ...
def translate_pattern(pattern: str | Pattern[str], *, is_regex: Literal[True, 1] = ...) -> Pattern[str]: ...
@overload
def translate_pattern(
pattern: Union[str, Pattern[str]],
anchor: Union[int, bool] = ...,
prefix: Optional[str] = ...,
is_regex: Union[int, bool] = ...,
pattern: str | Pattern[str], anchor: int | bool = ..., prefix: str | None = ..., is_regex: int | bool = ...
) -> Pattern[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,13 +1,13 @@
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: ...

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: Optional[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 = ...) -> None: ...
def readline(self) -> str | None: ...
def readlines(self) -> List[str]: ...
def unreadline(self, line: str) -> str: ...

View File

@@ -1,38 +1,38 @@
from abc import abstractmethod
from typing import Optional, Pattern, Tuple, TypeVar, Union
from typing import Pattern, Tuple, TypeVar
_T = TypeVar("_T", bound=Version)
class Version:
def __repr__(self) -> str: ...
def __eq__(self, other: object) -> bool: ...
def __lt__(self: _T, other: Union[_T, str]) -> bool: ...
def __le__(self: _T, other: Union[_T, str]) -> bool: ...
def __gt__(self: _T, other: Union[_T, str]) -> bool: ...
def __ge__(self: _T, other: Union[_T, str]) -> bool: ...
def __lt__(self: _T, other: _T | str) -> bool: ...
def __le__(self: _T, other: _T | str) -> bool: ...
def __gt__(self: _T, other: _T | str) -> bool: ...
def __ge__(self: _T, other: _T | str) -> bool: ...
@abstractmethod
def __init__(self, vstring: Optional[str] = ...) -> None: ...
def __init__(self, vstring: str | None = ...) -> None: ...
@abstractmethod
def parse(self: _T, vstring: str) -> _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[str, int]]
def __init__(self, vstring: Optional[str] = ...) -> None: ...
prerelease: Tuple[str, int] | None
def __init__(self, vstring: str | None = ...) -> None: ...
def parse(self: _T, vstring: str) -> _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: str
version: Tuple[Union[str, int], ...]
def __init__(self, vstring: Optional[str] = ...) -> None: ...
version: Tuple[str | int, ...]
def __init__(self, vstring: str | None = ...) -> None: ...
def parse(self: _T, vstring: str) -> _T: ...
def __str__(self) -> str: ...
def _cmp(self: _T, other: Union[_T, str]) -> bool: ...
def _cmp(self: _T, other: _T | str) -> bool: ...