From ab5d7750d8328780a3396880a11d8e843f8c1ae6 Mon Sep 17 00:00:00 2001 From: Avasam Date: Mon, 22 Jul 2024 15:51:40 -0400 Subject: [PATCH] Replace bare Any in setuptools --- stdlib/distutils/dist.pyi | 6 ++-- stubs/setuptools/pkg_resources/__init__.pyi | 6 ++-- stubs/setuptools/setuptools/__init__.pyi | 9 +++--- .../setuptools/setuptools/_distutils/dist.pyi | 6 ++-- stubs/setuptools/setuptools/archive_util.pyi | 4 +-- stubs/setuptools/setuptools/build_meta.pyi | 17 +++++----- stubs/setuptools/setuptools/command/alias.pyi | 11 ++++--- .../setuptools/command/bdist_wheel.pyi | 6 ++-- .../setuptools/command/build_ext.pyi | 14 ++++----- .../setuptools/command/build_py.pyi | 12 +++---- .../setuptools/setuptools/command/develop.pyi | 22 +++++++------ .../setuptools/command/dist_info.pyi | 6 ++-- .../setuptools/setuptools/command/install.pyi | 11 ++++--- .../setuptools/command/install_egg_info.pyi | 13 ++++---- .../setuptools/setuptools/command/rotate.pyi | 13 ++++---- stubs/setuptools/setuptools/command/sdist.pyi | 13 ++++---- .../setuptools/setuptools/command/setopt.pyi | 25 ++++++++------- stubs/setuptools/setuptools/command/test.pyi | 21 +++++++------ .../setuptools/command/upload_docs.pyi | 5 +-- stubs/setuptools/setuptools/config/expand.pyi | 2 +- stubs/setuptools/setuptools/dist.pyi | 4 +-- stubs/setuptools/setuptools/extension.pyi | 4 +-- stubs/setuptools/setuptools/namespaces.pyi | 4 +-- stubs/setuptools/setuptools/package_index.pyi | 31 ++++++++++--------- stubs/setuptools/setuptools/sandbox.pyi | 7 +++-- stubs/setuptools/setuptools/wheel.pyi | 6 ++-- 26 files changed, 146 insertions(+), 132 deletions(-) diff --git a/stdlib/distutils/dist.pyi b/stdlib/distutils/dist.pyi index 4094df903325..21ddbc425918 100644 --- a/stdlib/distutils/dist.pyi +++ b/stdlib/distutils/dist.pyi @@ -1,8 +1,8 @@ from _typeshed import Incomplete, StrOrBytesPath, StrPath, SupportsWrite -from collections.abc import Iterable, Mapping +from collections.abc import Iterable, MutableMapping from distutils.cmd import Command from re import Pattern -from typing import IO, Any, ClassVar, Literal, TypeVar, overload +from typing import IO, ClassVar, Literal, TypeVar, overload from typing_extensions import TypeAlias command_re: Pattern[str] @@ -60,7 +60,7 @@ class DistributionMetadata: class Distribution: cmdclass: dict[str, type[Command]] metadata: DistributionMetadata - def __init__(self, attrs: Mapping[str, Any] | None = None) -> None: ... + def __init__(self, attrs: MutableMapping[str, Incomplete] | None = None) -> None: ... def get_option_dict(self, command: str) -> dict[str, tuple[str, str]]: ... def parse_config_files(self, filenames: Iterable[str] | None = None) -> None: ... @overload diff --git a/stubs/setuptools/pkg_resources/__init__.pyi b/stubs/setuptools/pkg_resources/__init__.pyi index ea80a85cdcdd..2187fde20a5c 100644 --- a/stubs/setuptools/pkg_resources/__init__.pyi +++ b/stubs/setuptools/pkg_resources/__init__.pyi @@ -177,7 +177,7 @@ class WorkingSet: fallback: bool = True, ) -> tuple[list[Distribution], dict[Distribution, Exception]]: ... def require(self, *requirements: _NestedStr) -> Sequence[Distribution]: ... - def subscribe(self, callback: Callable[[Distribution], object], existing: bool = True) -> None: ... + def subscribe(self, callback: Callable[[Distribution], Unused], existing: bool = True) -> None: ... class Environment: def __init__( @@ -254,7 +254,9 @@ class EntryPoint: self, require: Literal[True] = True, env: Environment | None = None, installer: _InstallerType | None = None ) -> _ResolvedEntryPoint: ... @overload - def load(self, require: Literal[False], *args: Any, **kwargs: Any) -> _ResolvedEntryPoint: ... + def load( + self, require: Literal[False], *args: Environment | _InstallerType | None, **kwargs: Environment | _InstallerType | None + ) -> _ResolvedEntryPoint: ... def resolve(self) -> _ResolvedEntryPoint: ... def require(self, env: Environment | None = None, installer: _InstallerType | None = None) -> None: ... pattern: ClassVar[Pattern[str]] diff --git a/stubs/setuptools/setuptools/__init__.pyi b/stubs/setuptools/setuptools/__init__.pyi index e16ea24497c6..c3a88c8776fb 100644 --- a/stubs/setuptools/setuptools/__init__.pyi +++ b/stubs/setuptools/setuptools/__init__.pyi @@ -1,4 +1,4 @@ -from _typeshed import StrPath +from _typeshed import Incomplete, StrPath from abc import abstractmethod from collections.abc import Iterable, Mapping, Sequence from typing import Any @@ -48,7 +48,7 @@ def setup( distclass: type[Distribution] = ..., script_name: str = ..., script_args: list[str] = ..., - options: Mapping[str, Any] = ..., + options: Mapping[str, Incomplete] = ..., license: str = ..., keywords: list[str] | str = ..., platforms: list[str] | str = ..., @@ -59,7 +59,7 @@ def setup( provides: list[str] = ..., requires: list[str] = ..., command_packages: list[str] = ..., - command_options: Mapping[str, Mapping[str, tuple[Any, Any]]] = ..., + command_options: Mapping[str, Mapping[str, tuple[Incomplete, Incomplete]]] = ..., package_data: Mapping[str, list[str]] = ..., include_package_data: bool = ..., libraries: list[str] = ..., @@ -68,12 +68,13 @@ def setup( include_dirs: list[str] = ..., password: str = ..., fullname: str = ..., - **attrs: Any, + **attrs, ) -> Distribution: ... class Command(_Command): command_consumes_arguments: bool distribution: Distribution + # Any: Dynamic command subclass attributes def __init__(self, dist: Distribution, **kw: Any) -> None: ... def ensure_string_list(self, option: str | list[str]) -> None: ... def reinitialize_command(self, command: _Command | str, reinit_subcommands: bool = False, **kw: Any) -> _Command: ... # type: ignore[override] diff --git a/stubs/setuptools/setuptools/_distutils/dist.pyi b/stubs/setuptools/setuptools/_distutils/dist.pyi index 85910d972e43..e363c0b69b7a 100644 --- a/stubs/setuptools/setuptools/_distutils/dist.pyi +++ b/stubs/setuptools/setuptools/_distutils/dist.pyi @@ -1,7 +1,7 @@ from _typeshed import Incomplete, StrOrBytesPath, StrPath, SupportsWrite -from collections.abc import Iterable, Mapping +from collections.abc import Iterable, MutableMapping from re import Pattern -from typing import IO, Any, ClassVar, Literal, TypeVar, overload +from typing import IO, ClassVar, Literal, TypeVar, overload from typing_extensions import TypeAlias from .cmd import Command @@ -61,7 +61,7 @@ class DistributionMetadata: class Distribution: cmdclass: dict[str, type[Command]] metadata: DistributionMetadata - def __init__(self, attrs: Mapping[str, Any] | None = None) -> None: ... + def __init__(self, attrs: MutableMapping[str, Incomplete] | None = None) -> None: ... def get_option_dict(self, command: str) -> dict[str, tuple[str, str]]: ... def parse_config_files(self, filenames: Iterable[str] | None = None) -> None: ... @overload diff --git a/stubs/setuptools/setuptools/archive_util.pyi b/stubs/setuptools/setuptools/archive_util.pyi index 44fe556de4b5..600586a65578 100644 --- a/stubs/setuptools/setuptools/archive_util.pyi +++ b/stubs/setuptools/setuptools/archive_util.pyi @@ -1,5 +1,5 @@ from _typeshed import Incomplete -from typing import Any +from collections.abc import Callable from ._distutils.errors import DistutilsError @@ -21,4 +21,4 @@ def unpack_directory(filename, extract_dir, progress_filter=...) -> None: ... def unpack_zipfile(filename, extract_dir, progress_filter=...) -> None: ... def unpack_tarfile(filename, extract_dir, progress_filter=...): ... -extraction_drivers: Any +extraction_drivers: tuple[Callable[..., Incomplete], ...] diff --git a/stubs/setuptools/setuptools/build_meta.pyi b/stubs/setuptools/setuptools/build_meta.pyi index cf04af017fb1..4f3ae04151f9 100644 --- a/stubs/setuptools/setuptools/build_meta.pyi +++ b/stubs/setuptools/setuptools/build_meta.pyi @@ -1,6 +1,5 @@ -from _typeshed import StrPath +from _typeshed import Incomplete, StrPath from collections.abc import Mapping -from typing import Any from typing_extensions import TypeAlias from . import dist @@ -18,10 +17,10 @@ __all__ = [ "SetupRequirementsError", ] -_ConfigSettings: TypeAlias = dict[str, str | list[str] | None] | None +_ConfigSettings: TypeAlias = Mapping[str, str | list[str] | None] | None class SetupRequirementsError(BaseException): - specifiers: Any + specifiers: Incomplete def __init__(self, specifiers) -> None: ... class Distribution(dist.Distribution): @@ -31,10 +30,10 @@ class Distribution(dist.Distribution): class _BuildMetaBackend: def run_setup(self, setup_script: str = "setup.py") -> None: ... - def get_requires_for_build_wheel(self, config_settings: Mapping[str, Any] | None = None) -> list[str]: ... - def get_requires_for_build_sdist(self, config_settings: Mapping[str, Any] | None = None) -> list[str]: ... + def get_requires_for_build_wheel(self, config_settings: _ConfigSettings | None = None) -> list[str]: ... + def get_requires_for_build_sdist(self, config_settings: _ConfigSettings | None = None) -> list[str]: ... def prepare_metadata_for_build_wheel( - self, metadata_directory: str, config_settings: Mapping[str, Any] | None = None + self, metadata_directory: str, config_settings: _ConfigSettings | None = None ) -> str: ... def build_wheel( self, wheel_directory: StrPath, config_settings: _ConfigSettings | None = None, metadata_directory: StrPath | None = None @@ -43,9 +42,9 @@ class _BuildMetaBackend: def build_editable( self, wheel_directory: StrPath, config_settings: _ConfigSettings | None = None, metadata_directory: str | None = None ) -> str: ... - def get_requires_for_build_editable(self, config_settings: Mapping[str, Any] | None = None) -> list[str]: ... + def get_requires_for_build_editable(self, config_settings: _ConfigSettings | None = None) -> list[str]: ... def prepare_metadata_for_build_editable( - self, metadata_directory: str, config_settings: Mapping[str, Any] | None = None + self, metadata_directory: str, config_settings: _ConfigSettings | None = None ) -> str: ... class _BuildMetaLegacyBackend(_BuildMetaBackend): diff --git a/stubs/setuptools/setuptools/command/alias.pyi b/stubs/setuptools/setuptools/command/alias.pyi index 6486ffaa845a..cd3b4d9b5b74 100644 --- a/stubs/setuptools/setuptools/command/alias.pyi +++ b/stubs/setuptools/setuptools/command/alias.pyi @@ -1,4 +1,5 @@ -from typing import Any +from _typeshed import Incomplete +from typing import ClassVar from .setopt import option_base @@ -7,10 +8,10 @@ def shquote(arg): ... class alias(option_base): description: str command_consumes_arguments: bool - user_options: Any - boolean_options: Any - args: Any - remove: Any + user_options: ClassVar[list[tuple[str, str, str]]] + boolean_options: ClassVar[list[str]] + args: Incomplete + remove: Incomplete def initialize_options(self) -> None: ... def finalize_options(self) -> None: ... def run(self) -> None: ... diff --git a/stubs/setuptools/setuptools/command/bdist_wheel.pyi b/stubs/setuptools/setuptools/command/bdist_wheel.pyi index 9f416a7c4d82..b9f7f6fc926e 100644 --- a/stubs/setuptools/setuptools/command/bdist_wheel.pyi +++ b/stubs/setuptools/setuptools/command/bdist_wheel.pyi @@ -1,4 +1,4 @@ -from _typeshed import Incomplete +from _typeshed import Incomplete, Unused from collections.abc import Callable, Iterable from types import TracebackType from typing import Any, ClassVar, Final, Literal @@ -19,9 +19,9 @@ def get_abi_tag() -> str | None: ... def safer_name(name: str) -> str: ... def safer_version(version: str) -> str: ... def remove_readonly( - func: Callable[..., object], path: str, excinfo: tuple[type[Exception], Exception, TracebackType] + func: Callable[[str], Unused], path: str, excinfo: tuple[type[Exception], Exception, TracebackType] ) -> None: ... -def remove_readonly_exc(func: Callable[..., object], path: str, exc: Exception) -> None: ... +def remove_readonly_exc(func: Callable[[str], Unused], path: str, exc: Exception) -> None: ... class bdist_wheel(Command): description: ClassVar[str] diff --git a/stubs/setuptools/setuptools/command/build_ext.pyi b/stubs/setuptools/setuptools/command/build_ext.pyi index 584bfbbc2765..f67095c7e246 100644 --- a/stubs/setuptools/setuptools/command/build_ext.pyi +++ b/stubs/setuptools/setuptools/command/build_ext.pyi @@ -1,5 +1,5 @@ from _typeshed import Incomplete -from typing import Any, ClassVar +from typing import ClassVar from .._distutils.command.build_ext import build_ext as _build_ext @@ -12,19 +12,19 @@ def get_abi3_suffix(): ... class build_ext(_build_ext): editable_mode: ClassVar[bool] - inplace: Any + inplace: bool def run(self) -> None: ... def copy_extensions_to_source(self) -> None: ... def get_ext_filename(self, fullname): ... - shlib_compiler: Any - shlibs: Any - ext_map: Any + shlib_compiler: Incomplete + shlibs: list[Incomplete] + ext_map: dict[Incomplete, Incomplete] def initialize_options(self) -> None: ... - extensions: Any + extensions: list[Incomplete] def finalize_options(self) -> None: ... def setup_shlib_compiler(self) -> None: ... def get_export_symbols(self, ext): ... - compiler: Any + compiler: Incomplete def build_extension(self, ext) -> None: ... def links_to_dynamic(self, ext): ... def get_outputs(self): ... diff --git a/stubs/setuptools/setuptools/command/build_py.pyi b/stubs/setuptools/setuptools/command/build_py.pyi index ea6e94ea11bf..fe71ff6c0a9e 100644 --- a/stubs/setuptools/setuptools/command/build_py.pyi +++ b/stubs/setuptools/setuptools/command/build_py.pyi @@ -1,5 +1,5 @@ from _typeshed import Incomplete, StrPath -from typing import Any, ClassVar +from typing import ClassVar from .._distutils.cmd import _StrPathT from .._distutils.command import build_py as orig @@ -8,8 +8,8 @@ def make_writable(target) -> None: ... class build_py(orig.build_py): editable_mode: ClassVar[bool] - package_data: Any - exclude_package_data: Any + package_data: dict[str, list[str]] + exclude_package_data: dict[Incomplete, Incomplete] def finalize_options(self) -> None: ... def copy_file( # type: ignore[override] self, @@ -21,19 +21,19 @@ class build_py(orig.build_py): level=1, ) -> tuple[_StrPathT | str, bool]: ... def run(self) -> None: ... - data_files: Any + data_files: list[tuple[Incomplete, Incomplete, Incomplete, list[Incomplete]]] def __getattr__(self, attr: str): ... def build_module(self, module, module_file, package): ... def get_data_files_without_manifest(self) -> list[tuple[Incomplete, Incomplete, Incomplete, list[Incomplete]]]: ... def find_data_files(self, package, src_dir): ... def get_outputs(self, include_bytecode: bool = True) -> list[str]: ... # type: ignore[override] def build_package_data(self) -> None: ... - manifest_files: Any + manifest_files: dict[Incomplete, Incomplete] def get_output_mapping(self) -> dict[str, str]: ... def analyze_manifest(self) -> None: ... def get_data_files(self) -> None: ... def check_package(self, package, package_dir): ... - packages_checked: Any + packages_checked: dict[Incomplete, Incomplete] def initialize_options(self) -> None: ... def get_package_dir(self, package): ... def exclude_data_files(self, package, src_dir, files): ... diff --git a/stubs/setuptools/setuptools/command/develop.pyi b/stubs/setuptools/setuptools/command/develop.pyi index ebefbc2d49b7..e06c38a48170 100644 --- a/stubs/setuptools/setuptools/command/develop.pyi +++ b/stubs/setuptools/setuptools/command/develop.pyi @@ -1,24 +1,26 @@ -from typing import Any +from _typeshed import Incomplete + +from pkg_resources import Distribution from .. import namespaces from .easy_install import easy_install class develop(namespaces.DevelopInstaller, easy_install): description: str - user_options: Any - boolean_options: Any + user_options: Incomplete + boolean_options: Incomplete command_consumes_arguments: bool multi_version: bool def run(self) -> None: ... # type: ignore[override] - uninstall: Any - egg_path: Any - setup_path: Any + uninstall: Incomplete + egg_path: Incomplete + setup_path: Incomplete always_copy_from: str def initialize_options(self) -> None: ... - args: Any - egg_link: Any - egg_base: Any - dist: Any + args: list[Incomplete] + egg_link: str + egg_base: Incomplete + dist: Distribution def finalize_options(self) -> None: ... def install_for_development(self) -> None: ... def uninstall_link(self) -> None: ... diff --git a/stubs/setuptools/setuptools/command/dist_info.pyi b/stubs/setuptools/setuptools/command/dist_info.pyi index 723a764d7ba3..d89a1e937f1a 100644 --- a/stubs/setuptools/setuptools/command/dist_info.pyi +++ b/stubs/setuptools/setuptools/command/dist_info.pyi @@ -1,13 +1,13 @@ -from typing import Any, ClassVar +from _typeshed import Incomplete +from typing import ClassVar from .._distutils.cmd import Command class dist_info(Command): description: str - user_options: Any + user_options: Incomplete boolean_options: ClassVar[list[str]] negative_opt: ClassVar[dict[str, str]] - egg_base: Any def initialize_options(self) -> None: ... def finalize_options(self) -> None: ... def run(self) -> None: ... diff --git a/stubs/setuptools/setuptools/command/install.pyi b/stubs/setuptools/setuptools/command/install.pyi index b5fa8d634047..b3382783ddb1 100644 --- a/stubs/setuptools/setuptools/command/install.pyi +++ b/stubs/setuptools/setuptools/command/install.pyi @@ -1,18 +1,19 @@ +from _typeshed import Incomplete from collections.abc import Callable from typing import Any from .._distutils.command import install as orig class install(orig.install): - user_options: Any - boolean_options: Any + user_options: Incomplete + boolean_options: Incomplete # Any to work around variance issues new_commands: list[tuple[str, Callable[[Any], bool]] | None] - old_and_unmanageable: Any - single_version_externally_managed: Any + old_and_unmanageable: Incomplete + single_version_externally_managed: Incomplete def initialize_options(self) -> None: ... def finalize_options(self) -> None: ... - path_file: Any + path_file: Incomplete extra_dirs: str def handle_extra_path(self): ... def run(self): ... diff --git a/stubs/setuptools/setuptools/command/install_egg_info.pyi b/stubs/setuptools/setuptools/command/install_egg_info.pyi index a37c98cca4fd..d1a8dd4fef53 100644 --- a/stubs/setuptools/setuptools/command/install_egg_info.pyi +++ b/stubs/setuptools/setuptools/command/install_egg_info.pyi @@ -1,15 +1,16 @@ -from typing import Any +from _typeshed import Incomplete +from typing import ClassVar from .. import Command, namespaces class install_egg_info(namespaces.Installer, Command): description: str - user_options: Any - install_dir: Any + user_options: ClassVar[list[tuple[str, str, str]]] + install_dir: Incomplete def initialize_options(self) -> None: ... - source: Any - target: Any - outputs: Any + source: Incomplete + target: str + outputs: list[Incomplete] def finalize_options(self) -> None: ... def run(self) -> None: ... def get_outputs(self): ... diff --git a/stubs/setuptools/setuptools/command/rotate.pyi b/stubs/setuptools/setuptools/command/rotate.pyi index 7deb47389fb2..653a380bc29a 100644 --- a/stubs/setuptools/setuptools/command/rotate.pyi +++ b/stubs/setuptools/setuptools/command/rotate.pyi @@ -1,14 +1,15 @@ -from typing import Any +from _typeshed import Incomplete +from typing import ClassVar from .. import Command class rotate(Command): description: str - user_options: Any - boolean_options: list[str] - match: Any - dist_dir: Any - keep: Any + user_options: ClassVar[list[tuple[str, str, str]]] + boolean_options: ClassVar[list[str]] + match: Incomplete + dist_dir: Incomplete + keep: Incomplete def initialize_options(self) -> None: ... def finalize_options(self) -> None: ... def run(self) -> None: ... diff --git a/stubs/setuptools/setuptools/command/sdist.pyi b/stubs/setuptools/setuptools/command/sdist.pyi index fe4b59d73dad..d2e10aff20b2 100644 --- a/stubs/setuptools/setuptools/command/sdist.pyi +++ b/stubs/setuptools/setuptools/command/sdist.pyi @@ -1,15 +1,16 @@ -from typing import Any +from _typeshed import Incomplete +from typing import ClassVar from .._distutils.command import sdist as orig def walk_revctrl(dirname: str = "") -> None: ... class sdist(orig.sdist): - user_options: Any - negative_opt: Any - README_EXTENSIONS: Any - READMES: Any - filelist: Any + user_options: Incomplete + negative_opt: Incomplete + README_EXTENSIONS: ClassVar[list[str]] + READMES: Incomplete + filelist: Incomplete def run(self) -> None: ... def initialize_options(self) -> None: ... def make_distribution(self) -> None: ... diff --git a/stubs/setuptools/setuptools/command/setopt.pyi b/stubs/setuptools/setuptools/command/setopt.pyi index c57c3601d5ff..0e16758cf7f4 100644 --- a/stubs/setuptools/setuptools/command/setopt.pyi +++ b/stubs/setuptools/setuptools/command/setopt.pyi @@ -1,5 +1,6 @@ +from _typeshed import Incomplete from abc import abstractmethod -from typing import Any +from typing import ClassVar from .. import Command @@ -9,11 +10,11 @@ def config_file(kind: str = "local"): ... def edit_config(filename, settings, dry_run: bool = False) -> None: ... class option_base(Command): - user_options: Any - boolean_options: Any - global_config: Any - user_config: Any - filename: Any + user_options: ClassVar[list[tuple[str, str, str]]] + boolean_options: ClassVar[list[str]] + global_config: Incomplete + user_config: Incomplete + filename: Incomplete def initialize_options(self) -> None: ... def finalize_options(self) -> None: ... @abstractmethod @@ -21,12 +22,12 @@ class option_base(Command): class setopt(option_base): description: str - user_options: Any - boolean_options: Any - command: Any - option: Any - set_value: Any - remove: Any + user_options: ClassVar[list[tuple[str, str, str]]] + boolean_options: ClassVar[list[str]] + command: Incomplete + option: Incomplete + set_value: Incomplete + remove: Incomplete def initialize_options(self) -> None: ... def finalize_options(self) -> None: ... def run(self) -> None: ... diff --git a/stubs/setuptools/setuptools/command/test.pyi b/stubs/setuptools/setuptools/command/test.pyi index c475e1d097bc..3c2c22673f13 100644 --- a/stubs/setuptools/setuptools/command/test.pyi +++ b/stubs/setuptools/setuptools/command/test.pyi @@ -1,33 +1,34 @@ from _typeshed import Incomplete, Unused from collections.abc import Callable from types import ModuleType -from typing import Any, Generic, TypeVar, overload +from typing import ClassVar, Generic, TypeVar, overload from typing_extensions import Self from unittest import TestLoader, TestSuite from .. import Command _T = TypeVar("_T") +_R = TypeVar("_R") class ScanningLoader(TestLoader): def __init__(self) -> None: ... def loadTestsFromModule(self, module: ModuleType, pattern: Incomplete | None = None) -> list[TestSuite]: ... # type: ignore[override] -class NonDataProperty(Generic[_T]): - fget: Callable[..., _T] - def __init__(self, fget: Callable[..., _T]) -> None: ... +class NonDataProperty(Generic[_T, _R]): + fget: Callable[[_T], _R] + def __init__(self, fget: Callable[[_T], _R]) -> None: ... @overload def __get__(self, obj: None, objtype: Unused = None) -> Self: ... @overload - def __get__(self, obj: Any, objtype: Unused = None) -> _T: ... + def __get__(self, obj: _T, objtype: Unused = None) -> _R: ... class test(Command): description: str - user_options: Any - test_suite: Any - test_module: Any - test_loader: Any - test_runner: Any + user_options: ClassVar[list[tuple[str, str, str]]] + test_suite: Incomplete + test_module: Incomplete + test_loader: Incomplete + test_runner: Incomplete def initialize_options(self) -> None: ... def finalize_options(self) -> None: ... @NonDataProperty diff --git a/stubs/setuptools/setuptools/command/upload_docs.pyi b/stubs/setuptools/setuptools/command/upload_docs.pyi index 57e0c20ec7e2..f8ed816acc95 100644 --- a/stubs/setuptools/setuptools/command/upload_docs.pyi +++ b/stubs/setuptools/setuptools/command/upload_docs.pyi @@ -1,3 +1,4 @@ +from _typeshed import Incomplete from collections.abc import Callable from typing import Any, ClassVar @@ -11,8 +12,8 @@ class upload_docs(upload): def has_sphinx(self): ... # Any to work around variance issues sub_commands: ClassVar[list[tuple[str, Callable[[Any], bool] | None]]] - upload_dir: Any - target_dir: Any + upload_dir: Incomplete + target_dir: Incomplete def initialize_options(self) -> None: ... def finalize_options(self) -> None: ... def create_zipfile(self, filename) -> None: ... diff --git a/stubs/setuptools/setuptools/config/expand.pyi b/stubs/setuptools/setuptools/config/expand.pyi index 8695c8605db1..0bc46382ef7a 100644 --- a/stubs/setuptools/setuptools/config/expand.pyi +++ b/stubs/setuptools/setuptools/config/expand.pyi @@ -26,7 +26,7 @@ def cmdclass( def find_packages( *, namespaces: bool = True, fill_package_dir: dict[str, str] | None = None, root_dir: StrPath | None = None, **kwargs ) -> list[str]: ... -def version(value: Callable[..., Incomplete] | Iterable[str | int] | str) -> str: ... +def version(value: Callable[[], Incomplete] | Iterable[str | int] | str) -> str: ... def canonic_package_data(package_data: dict[Incomplete, Incomplete]) -> dict[Incomplete, Incomplete]: ... def canonic_data_files( data_files: list[Incomplete] | dict[Incomplete, Incomplete], root_dir: StrPath | None = None diff --git a/stubs/setuptools/setuptools/dist.pyi b/stubs/setuptools/setuptools/dist.pyi index 6c9cba974c75..f151b388fa0d 100644 --- a/stubs/setuptools/setuptools/dist.pyi +++ b/stubs/setuptools/setuptools/dist.pyi @@ -1,5 +1,5 @@ +from _typeshed import Incomplete from collections.abc import Iterable, Iterator, MutableMapping -from typing import Any from . import Command, SetuptoolsDeprecationWarning from ._distutils.dist import Distribution as _Distribution @@ -10,7 +10,7 @@ class Distribution(_Distribution): src_root: str | None dependency_links: list[str] setup_requires: list[str] - def __init__(self, attrs: MutableMapping[str, Any] | None = None) -> None: ... + def __init__(self, attrs: MutableMapping[str, Incomplete] | None = None) -> None: ... def warn_dash_deprecation(self, opt: str, section: str) -> str: ... def make_option_lowercase(self, opt: str, section: str) -> str: ... def parse_config_files(self, filenames: Iterable[str] | None = None, ignore_option_errors: bool = False) -> None: ... diff --git a/stubs/setuptools/setuptools/extension.pyi b/stubs/setuptools/setuptools/extension.pyi index f32953d158bf..6cb7d7aad9dd 100644 --- a/stubs/setuptools/setuptools/extension.pyi +++ b/stubs/setuptools/setuptools/extension.pyi @@ -1,8 +1,6 @@ -from typing import Any - from ._distutils.extension import Extension as _Extension -have_pyrex: Any +def have_pyrex() -> bool: ... class Extension(_Extension): py_limited_api: bool diff --git a/stubs/setuptools/setuptools/namespaces.pyi b/stubs/setuptools/setuptools/namespaces.pyi index b85fcec71da8..9170ecfdd5e6 100644 --- a/stubs/setuptools/setuptools/namespaces.pyi +++ b/stubs/setuptools/setuptools/namespaces.pyi @@ -1,6 +1,6 @@ -from typing import Any +import itertools -flatten: Any +flatten = itertools.chain.from_iterable class Installer: nspkg_ext: str diff --git a/stubs/setuptools/setuptools/package_index.pyi b/stubs/setuptools/setuptools/package_index.pyi index b32b580b1665..833741ac7602 100644 --- a/stubs/setuptools/setuptools/package_index.pyi +++ b/stubs/setuptools/setuptools/package_index.pyi @@ -1,6 +1,9 @@ import configparser +import urllib.request from _typeshed import Incomplete -from typing import Any +from hashlib import _Hash +from re import Pattern +from typing import ClassVar from pkg_resources import Environment @@ -18,10 +21,10 @@ class ContentChecker: def report(self, reporter, template) -> None: ... class HashChecker(ContentChecker): - pattern: Any - hash_name: Any - hash: Any - expected: Any + pattern: ClassVar[Pattern[str]] + hash_name: Incomplete + hash: _Hash + expected: Incomplete def __init__(self, hash_name, expected) -> None: ... @classmethod def from_url(cls, url): ... @@ -30,13 +33,13 @@ class HashChecker(ContentChecker): def report(self, reporter, template): ... class PackageIndex(Environment): - index_url: Any - scanned_urls: Any - fetched_urls: Any - package_pages: Any - allows: Any - to_scan: Any - opener: Any + index_url: str + scanned_urls: dict[Incomplete, Incomplete] + fetched_urls: dict[Incomplete, Incomplete] + package_pages: dict[Incomplete, Incomplete] + allows: Incomplete + to_scan: list[Incomplete] + opener = urllib.request.urlopen def __init__( self, index_url: str = "https://pypi.org/simple/", @@ -81,8 +84,8 @@ class PackageIndex(Environment): def warn(self, msg, *args) -> None: ... class Credential: - username: Any - password: Any + username: Incomplete + password: Incomplete def __init__(self, username, password) -> None: ... def __iter__(self): ... diff --git a/stubs/setuptools/setuptools/sandbox.pyi b/stubs/setuptools/setuptools/sandbox.pyi index 32328ac7cac5..d057eeae9cf0 100644 --- a/stubs/setuptools/setuptools/sandbox.pyi +++ b/stubs/setuptools/setuptools/sandbox.pyi @@ -1,6 +1,7 @@ import sys +from _typeshed import Incomplete from types import TracebackType -from typing import Any, Literal +from typing import Literal from typing_extensions import Self from ._distutils.errors import DistutilsError @@ -56,10 +57,10 @@ class AbstractSandbox: def utime(self, path, *args, **kw): ... class DirectorySandbox(AbstractSandbox): - write_ops: Any + write_ops: Incomplete def __init__(self, sandbox, exceptions=...) -> None: ... def tmpnam(self) -> None: ... def open(self, file, flags, mode: int = 511, *args, **kw): ... # type: ignore[override] class SandboxViolation(DistutilsError): - tmpl: Any + tmpl: str diff --git a/stubs/setuptools/setuptools/wheel.pyi b/stubs/setuptools/setuptools/wheel.pyi index eeb7eee24b54..240e43d1ec59 100644 --- a/stubs/setuptools/setuptools/wheel.pyi +++ b/stubs/setuptools/setuptools/wheel.pyi @@ -1,14 +1,14 @@ +from _typeshed import Incomplete from collections.abc import Generator -from typing import Any -WHEEL_NAME: Any +WHEEL_NAME: Incomplete NAMESPACE_PACKAGE_INIT: str def unpack(src_dir, dst_dir) -> None: ... def disable_info_traces() -> Generator[None, None, None]: ... class Wheel: - filename: Any + filename: Incomplete def __init__(self, filename) -> None: ... def tags(self): ... def is_compatible(self): ...