Improve distutils and lib2to3 (#5763)

Add missing elements to distutils.util:

* run_2to3()
* copydir_run_2to3()
* Mixin2to3

Use PEP 604 and PEP 585.

Add lib2to3.refactor.
This commit is contained in:
Sebastian Rittau
2021-07-12 20:15:54 +02:00
committed by GitHub
parent 7c382c7cd8
commit 3bb397055c
3 changed files with 100 additions and 7 deletions

View File

@@ -1,23 +1,45 @@
from typing import Any, Callable, List, Mapping, Optional, Tuple
from _typeshed import StrPath
from collections.abc import Callable, Container, Iterable, Mapping
from typing import Any, Tuple
def get_platform() -> str: ...
def convert_path(pathname: str) -> str: ...
def change_root(new_root: str, pathname: str) -> str: ...
def check_environ() -> None: ...
def subst_vars(s: str, local_vars: Mapping[str, str]) -> None: ...
def split_quoted(s: str) -> List[str]: ...
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],
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: ...
def run_2to3(
files: Iterable[str],
fixer_names: Iterable[str] | None = ...,
options: Mapping[str, Any] | None = ...,
explicit: Container[str] | None = ..., # unused
) -> None: ...
def copydir_run_2to3(
src: StrPath,
dest: StrPath,
template: str | None = ...,
fixer_names: Iterable[str] | None = ...,
options: Mapping[str, Any] | None = ...,
explicit: Container[str] | None = ...,
) -> list[str]: ...
class Mixin2to3:
fixer_names: Iterable[str] | None
options: Mapping[str, Any] | None
explicit: Container[str] | None
def run_2to3(self, files: Iterable[str]) -> None: ...