Skip to content

Commit

Permalink
Reformatted distutils-stubs
Browse files Browse the repository at this point in the history
  • Loading branch information
Avasam committed Oct 25, 2024
1 parent b5f8ed4 commit 20bda1b
Show file tree
Hide file tree
Showing 25 changed files with 337 additions and 119 deletions.
3 changes: 1 addition & 2 deletions _distutils_hack/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
import sys

report_url = (
"https://github.com/pypa/setuptools/issues/new?"
"template=distutils-deprecation.yml"
"https://github.com/pypa/setuptools/issues/new?template=distutils-deprecation.yml"
)


Expand Down
16 changes: 12 additions & 4 deletions typings/distutils-stubs/_modified.pyi
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
from _typeshed import StrOrBytesPath
from collections.abc import Callable, Iterable
from typing import Literal, TypeVar

from _typeshed import StrOrBytesPath

_SourcesT = TypeVar("_SourcesT", bound=StrOrBytesPath)
_TargetsT = TypeVar("_TargetsT", bound=StrOrBytesPath)

def newer(source: StrOrBytesPath, target: StrOrBytesPath) -> bool: ...
def newer_pairwise(
sources: Iterable[_SourcesT], targets: Iterable[_TargetsT], newer: Callable[[_SourcesT, _TargetsT], bool] = newer
sources: Iterable[_SourcesT],
targets: Iterable[_TargetsT],
newer: Callable[[_SourcesT, _TargetsT], bool] = newer,
) -> tuple[list[_SourcesT], list[_TargetsT]]: ...
def newer_group(
sources: Iterable[StrOrBytesPath], target: StrOrBytesPath, missing: Literal["error", "ignore", "newer"] = "error"
sources: Iterable[StrOrBytesPath],
target: StrOrBytesPath,
missing: Literal["error", "ignore", "newer"] = "error",
) -> bool: ...
def newer_pairwise_group(
sources: Iterable[_SourcesT], targets: Iterable[_TargetsT], *, newer: Callable[[_SourcesT, _TargetsT], bool] = newer
sources: Iterable[_SourcesT],
targets: Iterable[_TargetsT],
*,
newer: Callable[[_SourcesT, _TargetsT], bool] = newer,
) -> tuple[list[_SourcesT], list[_TargetsT]]: ...
7 changes: 5 additions & 2 deletions typings/distutils-stubs/archive_util.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from _typeshed import StrOrBytesPath, StrPath
from typing import Literal, overload

from _typeshed import StrOrBytesPath, StrPath

@overload
def make_archive(
base_name: str,
Expand Down Expand Up @@ -32,4 +33,6 @@ def make_tarball(
owner: str | None = None,
group: str | None = None,
) -> str: ...
def make_zipfile(base_name: str, base_dir: str, verbose: bool = False, dry_run: bool = False) -> str: ...
def make_zipfile(
base_name: str, base_dir: str, verbose: bool = False, dry_run: bool = False
) -> str: ...
157 changes: 118 additions & 39 deletions typings/distutils-stubs/cmd.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from _typeshed import BytesPath, StrOrBytesPath, StrPath, Unused
from abc import abstractmethod
from collections.abc import Callable, Iterable
from typing import Any, ClassVar, Literal, TypeVar, overload

from _typeshed import BytesPath, StrOrBytesPath, StrPath, Unused
from typing_extensions import TypeVarTuple, Unpack

from .command.bdist import bdist
Expand Down Expand Up @@ -51,82 +52,140 @@ class Command:
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 set_undefined_options(
self, src_cmd: str, *option_pairs: tuple[str, str]
) -> None: ...
# NOTE: This list comes directly from the distutils/command folder. Minus bdist_msi and bdist_wininst.
@overload
def get_finalized_command(self, command: Literal["bdist"], create: bool = True) -> bdist: ...
def get_finalized_command(
self, command: Literal["bdist"], create: bool = True
) -> bdist: ...
@overload
def get_finalized_command(self, command: Literal["bdist_dumb"], create: bool = True) -> bdist_dumb: ...
def get_finalized_command(
self, command: Literal["bdist_dumb"], create: bool = True
) -> bdist_dumb: ...
@overload
def get_finalized_command(self, command: Literal["bdist_rpm"], create: bool = True) -> bdist_rpm: ...
def get_finalized_command(
self, command: Literal["bdist_rpm"], create: bool = True
) -> bdist_rpm: ...
@overload
def get_finalized_command(self, command: Literal["build"], create: bool = True) -> build: ...
def get_finalized_command(
self, command: Literal["build"], create: bool = True
) -> build: ...
@overload
def get_finalized_command(self, command: Literal["build_clib"], create: bool = True) -> build_clib: ...
def get_finalized_command(
self, command: Literal["build_clib"], create: bool = True
) -> build_clib: ...
@overload
def get_finalized_command(self, command: Literal["build_ext"], create: bool = True) -> build_ext: ...
def get_finalized_command(
self, command: Literal["build_ext"], create: bool = True
) -> build_ext: ...
@overload
def get_finalized_command(self, command: Literal["build_py"], create: bool = True) -> build_py: ...
def get_finalized_command(
self, command: Literal["build_py"], create: bool = True
) -> build_py: ...
@overload
def get_finalized_command(self, command: Literal["build_scripts"], create: bool = True) -> build_scripts: ...
def get_finalized_command(
self, command: Literal["build_scripts"], create: bool = True
) -> build_scripts: ...
@overload
def get_finalized_command(self, command: Literal["check"], create: bool = True) -> check: ...
def get_finalized_command(
self, command: Literal["check"], create: bool = True
) -> check: ...
@overload
def get_finalized_command(self, command: Literal["clean"], create: bool = True) -> clean: ...
def get_finalized_command(
self, command: Literal["clean"], create: bool = True
) -> clean: ...
@overload
def get_finalized_command(self, command: Literal["config"], create: bool = True) -> config: ...
def get_finalized_command(
self, command: Literal["config"], create: bool = True
) -> config: ...
@overload
def get_finalized_command(self, command: Literal["install"], create: bool = True) -> install: ...
def get_finalized_command(
self, command: Literal["install"], create: bool = True
) -> install: ...
@overload
def get_finalized_command(self, command: Literal["install_data"], create: bool = True) -> install_data: ...
def get_finalized_command(
self, command: Literal["install_data"], create: bool = True
) -> install_data: ...
@overload
def get_finalized_command(
self, command: Literal["install_egg_info"], create: bool = True
) -> install_egg_info: ...
@overload
def get_finalized_command(self, command: Literal["install_headers"], create: bool = True) -> install_headers: ...
def get_finalized_command(
self, command: Literal["install_headers"], create: bool = True
) -> install_headers: ...
@overload
def get_finalized_command(self, command: Literal["install_lib"], create: bool = True) -> install_lib: ...
def get_finalized_command(
self, command: Literal["install_lib"], create: bool = True
) -> install_lib: ...
@overload
def get_finalized_command(self, command: Literal["install_scripts"], create: bool = True) -> install_scripts: ...
def get_finalized_command(
self, command: Literal["install_scripts"], create: bool = True
) -> install_scripts: ...
@overload
def get_finalized_command(self, command: Literal["register"], create: bool = True) -> register: ...
def get_finalized_command(
self, command: Literal["register"], create: bool = True
) -> register: ...
@overload
def get_finalized_command(self, command: Literal["sdist"], create: bool = True) -> sdist: ...
def get_finalized_command(
self, command: Literal["sdist"], create: bool = True
) -> sdist: ...
@overload
def get_finalized_command(self, command: Literal["upload"], create: bool = True) -> upload: ...
def get_finalized_command(
self, command: Literal["upload"], create: bool = True
) -> upload: ...
@overload
def get_finalized_command(self, command: str, create: bool = True) -> Command: ...
@overload
def reinitialize_command(self, command: Literal["bdist"], reinit_subcommands: bool = False) -> bdist: ...
def reinitialize_command(
self, command: Literal["bdist"], reinit_subcommands: bool = False
) -> bdist: ...
@overload
def reinitialize_command(
self, command: Literal["bdist_dumb"], reinit_subcommands: bool = False
) -> bdist_dumb: ...
@overload
def reinitialize_command(self, command: Literal["bdist_rpm"], reinit_subcommands: bool = False) -> bdist_rpm: ...
def reinitialize_command(
self, command: Literal["bdist_rpm"], reinit_subcommands: bool = False
) -> bdist_rpm: ...
@overload
def reinitialize_command(self, command: Literal["build"], reinit_subcommands: bool = False) -> build: ...
def reinitialize_command(
self, command: Literal["build"], reinit_subcommands: bool = False
) -> build: ...
@overload
def reinitialize_command(
self, command: Literal["build_clib"], reinit_subcommands: bool = False
) -> build_clib: ...
@overload
def reinitialize_command(self, command: Literal["build_ext"], reinit_subcommands: bool = False) -> build_ext: ...
def reinitialize_command(
self, command: Literal["build_ext"], reinit_subcommands: bool = False
) -> build_ext: ...
@overload
def reinitialize_command(self, command: Literal["build_py"], reinit_subcommands: bool = False) -> build_py: ...
def reinitialize_command(
self, command: Literal["build_py"], reinit_subcommands: bool = False
) -> build_py: ...
@overload
def reinitialize_command(
self, command: Literal["build_scripts"], reinit_subcommands: bool = False
) -> build_scripts: ...
@overload
def reinitialize_command(self, command: Literal["check"], reinit_subcommands: bool = False) -> check: ...
def reinitialize_command(
self, command: Literal["check"], reinit_subcommands: bool = False
) -> check: ...
@overload
def reinitialize_command(self, command: Literal["clean"], reinit_subcommands: bool = False) -> clean: ...
def reinitialize_command(
self, command: Literal["clean"], reinit_subcommands: bool = False
) -> clean: ...
@overload
def reinitialize_command(self, command: Literal["config"], reinit_subcommands: bool = False) -> config: ...
def reinitialize_command(
self, command: Literal["config"], reinit_subcommands: bool = False
) -> config: ...
@overload
def reinitialize_command(self, command: Literal["install"], reinit_subcommands: bool = False) -> install: ...
def reinitialize_command(
self, command: Literal["install"], reinit_subcommands: bool = False
) -> install: ...
@overload
def reinitialize_command(
self, command: Literal["install_data"], reinit_subcommands: bool = False
Expand All @@ -148,20 +207,34 @@ class Command:
self, command: Literal["install_scripts"], reinit_subcommands: bool = False
) -> install_scripts: ...
@overload
def reinitialize_command(self, command: Literal["register"], reinit_subcommands: bool = False) -> register: ...
def reinitialize_command(
self, command: Literal["register"], reinit_subcommands: bool = False
) -> register: ...
@overload
def reinitialize_command(self, command: Literal["sdist"], reinit_subcommands: bool = False) -> sdist: ...
def reinitialize_command(
self, command: Literal["sdist"], reinit_subcommands: bool = False
) -> sdist: ...
@overload
def reinitialize_command(self, command: Literal["upload"], reinit_subcommands: bool = False) -> upload: ...
def reinitialize_command(
self, command: Literal["upload"], reinit_subcommands: bool = False
) -> upload: ...
@overload
def reinitialize_command(self, command: str, reinit_subcommands: bool = False) -> Command: ...
def reinitialize_command(
self, command: str, reinit_subcommands: bool = False
) -> Command: ...
@overload
def reinitialize_command(self, command: _CommandT, reinit_subcommands: bool = False) -> _CommandT: ...
def reinitialize_command(
self, command: _CommandT, reinit_subcommands: bool = False
) -> _CommandT: ...
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[[Unpack[_Ts]], Unused], args: tuple[Unpack[_Ts]], msg: str | None = None, level: int = 1
self,
func: Callable[[Unpack[_Ts]], Unused],
args: tuple[Unpack[_Ts]],
msg: str | None = None,
level: int = 1,
) -> None: ...
def mkpath(self, name: str, mode: int = 0o777) -> None: ...
@overload
Expand Down Expand Up @@ -194,10 +267,16 @@ class Command:
level: Unused = 1,
) -> list[str]: ...
@overload
def move_file(self, src: StrPath, dst: _StrPathT, level: Unused = 1) -> _StrPathT | str: ...
def move_file(
self, src: StrPath, dst: _StrPathT, level: Unused = 1
) -> _StrPathT | str: ...
@overload
def move_file(self, src: BytesPath, dst: _BytesPathT, level: Unused = 1) -> _BytesPathT | bytes: ...
def spawn(self, cmd: Iterable[str], search_path: bool = True, level: Unused = 1) -> None: ...
def move_file(
self, src: BytesPath, dst: _BytesPathT, level: Unused = 1
) -> _BytesPathT | bytes: ...
def spawn(
self, cmd: Iterable[str], search_path: bool = True, level: Unused = 1
) -> None: ...
@overload
def make_archive(
self,
Expand Down
3 changes: 2 additions & 1 deletion typings/distutils-stubs/command/bdist.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from _typeshed import Unused
from collections.abc import Callable
from typing import ClassVar

from _typeshed import Unused
from typing_extensions import deprecated

from ..cmd import Command
Expand Down
3 changes: 2 additions & 1 deletion typings/distutils-stubs/command/bdist_dumb.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from _typeshed import Incomplete
from typing import ClassVar

from _typeshed import Incomplete

from ..cmd import Command

class bdist_dumb(Command):
Expand Down
3 changes: 2 additions & 1 deletion typings/distutils-stubs/command/bdist_rpm.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from _typeshed import Incomplete
from typing import ClassVar

from _typeshed import Incomplete

from ..cmd import Command

class bdist_rpm(Command):
Expand Down
3 changes: 2 additions & 1 deletion typings/distutils-stubs/command/build.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from _typeshed import Incomplete, Unused
from collections.abc import Callable
from typing import ClassVar

from _typeshed import Incomplete, Unused

from ..cmd import Command

def show_compilers() -> None: ...
Expand Down
3 changes: 2 additions & 1 deletion typings/distutils-stubs/command/build_clib.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from _typeshed import Incomplete, Unused
from collections.abc import Callable
from typing import ClassVar

from _typeshed import Incomplete, Unused

from ..cmd import Command

class build_clib(Command):
Expand Down
3 changes: 2 additions & 1 deletion typings/distutils-stubs/command/build_ext.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from _typeshed import Incomplete, Unused
from collections.abc import Callable
from typing import ClassVar

from _typeshed import Incomplete, Unused

from ..cmd import Command
from ..extension import Extension

Expand Down
3 changes: 2 additions & 1 deletion typings/distutils-stubs/command/build_py.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from _typeshed import Incomplete
from typing import ClassVar

from _typeshed import Incomplete

from ..cmd import Command

class build_py(Command):
Expand Down
3 changes: 2 additions & 1 deletion typings/distutils-stubs/command/build_scripts.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from _typeshed import Incomplete
from typing import ClassVar

from _typeshed import Incomplete

from ..cmd import Command

first_line_re: Incomplete
Expand Down
3 changes: 2 additions & 1 deletion typings/distutils-stubs/command/clean.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from _typeshed import Incomplete
from typing import ClassVar

from _typeshed import Incomplete

from ..cmd import Command

class clean(Command):
Expand Down
3 changes: 2 additions & 1 deletion typings/distutils-stubs/command/install.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from _typeshed import Incomplete
from typing import ClassVar

from _typeshed import Incomplete

from ..cmd import Command

class install(Command):
Expand Down
3 changes: 2 additions & 1 deletion typings/distutils-stubs/command/install_data.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from _typeshed import Incomplete
from typing import ClassVar

from _typeshed import Incomplete

from ..cmd import Command

class install_data(Command):
Expand Down
Loading

0 comments on commit 20bda1b

Please sign in to comment.