From a563475420eb19b074573853d69692c7e4a18d62 Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Thu, 23 May 2024 10:35:11 +0300 Subject: [PATCH] Enforce ruff/refurb rule FURB118 FURB118 Use `operator.itemgetter(0)` instead of defining a lambda --- setuptools/command/build_ext.py | 2 +- setuptools/command/build_py.py | 2 +- setuptools/command/editable_wheel.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/setuptools/command/build_ext.py b/setuptools/command/build_ext.py index 51c1771a33..08cc741284 100644 --- a/setuptools/command/build_ext.py +++ b/setuptools/command/build_ext.py @@ -319,7 +319,7 @@ def get_outputs(self) -> list[str]: def get_output_mapping(self) -> dict[str, str]: """See :class:`setuptools.commands.build.SubCommand`""" mapping = self._get_output_mapping() - return dict(sorted(mapping, key=lambda x: x[0])) + return dict(sorted(mapping, key=operator.itemgetter(0))) def __get_stubs_outputs(self): # assemble the base name for each extension that needs a stub diff --git a/setuptools/command/build_py.py b/setuptools/command/build_py.py index e6d9656f10..264a657b8b 100644 --- a/setuptools/command/build_py.py +++ b/setuptools/command/build_py.py @@ -153,7 +153,7 @@ def get_output_mapping(self) -> dict[str, str]: self._get_package_data_output_mapping(), self._get_module_mapping(), ) - return dict(sorted(mapping, key=lambda x: x[0])) + return dict(sorted(mapping, key=operator.itemgetter(0))) def _get_module_mapping(self) -> Iterator[tuple[str, str]]: """Iterate over all modules producing (dest, src) pairs.""" diff --git a/setuptools/command/editable_wheel.py b/setuptools/command/editable_wheel.py index 46852c1a94..c1a2f9bb2b 100644 --- a/setuptools/command/editable_wheel.py +++ b/setuptools/command/editable_wheel.py @@ -865,7 +865,7 @@ def _finder_template( """Create a string containing the code for the``MetaPathFinder`` and ``PathEntryFinder``. """ - mapping = dict(sorted(mapping.items(), key=lambda p: p[0])) + mapping = dict(sorted(mapping.items(), key=operator.itemgetter(0))) return _FINDER_TEMPLATE.format(name=name, mapping=mapping, namespaces=namespaces)