From f37cdae7b78ce783557ff1790343634c559d49cc Mon Sep 17 00:00:00 2001 From: Richard Si Date: Sun, 22 Dec 2024 19:23:22 -0500 Subject: [PATCH] Fix ConfiguredBuildBackendHookCaller type annotations --- .../operations/build/metadata_editable.py | 1 + src/pip/_internal/utils/misc.py | 27 ++++++++++--------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/pip/_internal/operations/build/metadata_editable.py b/src/pip/_internal/operations/build/metadata_editable.py index 27c69f0d1ea..3397ccf0f92 100644 --- a/src/pip/_internal/operations/build/metadata_editable.py +++ b/src/pip/_internal/operations/build/metadata_editable.py @@ -38,4 +38,5 @@ def generate_editable_metadata( except InstallationSubprocessError as error: raise MetadataGenerationFailed(package_details=details) from error + assert distinfo_dir is not None return os.path.join(metadata_dir, distinfo_dir) diff --git a/src/pip/_internal/utils/misc.py b/src/pip/_internal/utils/misc.py index c07405267d6..4b522b53640 100644 --- a/src/pip/_internal/utils/misc.py +++ b/src/pip/_internal/utils/misc.py @@ -19,12 +19,13 @@ Any, BinaryIO, Callable, - Dict, Generator, Iterable, Iterator, List, + Mapping, Optional, + Sequence, TextIO, Tuple, Type, @@ -667,7 +668,7 @@ def __init__( def build_wheel( self, wheel_directory: str, - config_settings: Optional[Dict[str, Union[str, List[str]]]] = None, + config_settings: Mapping[str, Any] | None = None, metadata_directory: Optional[str] = None, ) -> str: cs = self.config_holder.config_settings @@ -678,7 +679,7 @@ def build_wheel( def build_sdist( self, sdist_directory: str, - config_settings: Optional[Dict[str, Union[str, List[str]]]] = None, + config_settings: Mapping[str, Any] | None = None, ) -> str: cs = self.config_holder.config_settings return super().build_sdist(sdist_directory, config_settings=cs) @@ -686,7 +687,7 @@ def build_sdist( def build_editable( self, wheel_directory: str, - config_settings: Optional[Dict[str, Union[str, List[str]]]] = None, + config_settings: Mapping[str, Any] | None = None, metadata_directory: Optional[str] = None, ) -> str: cs = self.config_holder.config_settings @@ -695,27 +696,27 @@ def build_editable( ) def get_requires_for_build_wheel( - self, config_settings: Optional[Dict[str, Union[str, List[str]]]] = None - ) -> List[str]: + self, config_settings: Mapping[str, Any] | None = None + ) -> Sequence[str]: cs = self.config_holder.config_settings return super().get_requires_for_build_wheel(config_settings=cs) def get_requires_for_build_sdist( - self, config_settings: Optional[Dict[str, Union[str, List[str]]]] = None - ) -> List[str]: + self, config_settings: Mapping[str, Any] | None = None + ) -> Sequence[str]: cs = self.config_holder.config_settings return super().get_requires_for_build_sdist(config_settings=cs) def get_requires_for_build_editable( - self, config_settings: Optional[Dict[str, Union[str, List[str]]]] = None - ) -> List[str]: + self, config_settings: Mapping[str, Any] | None = None + ) -> Sequence[str]: cs = self.config_holder.config_settings return super().get_requires_for_build_editable(config_settings=cs) def prepare_metadata_for_build_wheel( self, metadata_directory: str, - config_settings: Optional[Dict[str, Union[str, List[str]]]] = None, + config_settings: Mapping[str, Any] | None = None, _allow_fallback: bool = True, ) -> str: cs = self.config_holder.config_settings @@ -728,9 +729,9 @@ def prepare_metadata_for_build_wheel( def prepare_metadata_for_build_editable( self, metadata_directory: str, - config_settings: Optional[Dict[str, Union[str, List[str]]]] = None, + config_settings: Mapping[str, Any] | None = None, _allow_fallback: bool = True, - ) -> str: + ) -> str | None: cs = self.config_holder.config_settings return super().prepare_metadata_for_build_editable( metadata_directory=metadata_directory,