Distutils improvements to cmd.pyi and log.pyi (#1748)

* Add more functions to distutils.cmd.Command.

* Add detail to distutils.log, previously an empty file.
This commit is contained in:
Neil Pilgrim
2017-11-27 12:47:04 -08:00
committed by Jelle Zijlstra
parent c1971fb443
commit fc10a94db1
2 changed files with 54 additions and 1 deletions

View File

@@ -1,6 +1,6 @@
# Stubs for distutils.cmd
from typing import Callable, List, Tuple, Union
from typing import Callable, List, Tuple, Union, Optional, Iterable, Any, Text
from abc import abstractmethod
from distutils.dist import Distribution
@@ -13,3 +13,28 @@ class Command:
def finalize_options(self) -> None: ...
@abstractmethod
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_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 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 mkpath(self, name: str, mode: int = ...) -> None: ...
def copy_file(self, infile: str, outfile: str, preserve_mode: int = ..., preserve_times: int = ..., link: Optional[str] = ..., level: Any = ...) -> Tuple[str, bool]: ... # level is not used
def copy_tree(self, infile: str, outfile: str, preserve_mode: int = ..., preserve_times: int = ..., preserve_symlinks: int = ..., level: Any = ...) -> List[str]: ... # level is not used
def move_file(self, src: str, dest: 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(self, base_name: str, format: str, root_dir: Optional[str] = ..., base_dir: Optional[str] = ..., owner: Optional[str] = ..., group: Optional[str] = ...) -> str: ...
def make_file(self, infiles: Union[str, List[str], Tuple[str]], outfile: str, func: Callable[..., Any], args: List[Any], exec_msg: Optional[str] = ..., skip_msg: Optional[str] = ..., level: Any = ...) -> None: ... # level is not used

View File

@@ -0,0 +1,28 @@
from typing import Any, Callable, Iterable, Text
DEBUG: int
INFO: int
WARN: int
ERROR: int
FATAL: int
class Log:
def __init__(self, threshold: int = ...) -> None: ...
def log(self, level: int, msg: Text, *args: Any) -> None: ...
def debug(self, msg: Text, *args: Any) -> None: ...
def info(self, msg: Text, *args: Any) -> None: ...
def warn(self, msg: Text, *args: Any) -> None: ...
def error(self, msg: Text, *args: Any) -> None: ...
def fatal(self, msg: Text, *args: Any) -> None: ...
_LogFunc = Callable[[Text, Iterable[Any]], None]
log: Callable[[int, Text, Iterable[Any]], None]
debug: _LogFunc
info: _LogFunc
warn: _LogFunc
error: _LogFunc
fatal: _LogFunc
def set_threshold(level: int) -> int: ...
def set_verbosity(v: int) -> None: ...