Skip to content

Commit a563475

Browse files
Enforce ruff/refurb rule FURB118
FURB118 Use `operator.itemgetter(0)` instead of defining a lambda
1 parent f3411b4 commit a563475

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

setuptools/command/build_ext.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ def get_outputs(self) -> list[str]:
319319
def get_output_mapping(self) -> dict[str, str]:
320320
"""See :class:`setuptools.commands.build.SubCommand`"""
321321
mapping = self._get_output_mapping()
322-
return dict(sorted(mapping, key=lambda x: x[0]))
322+
return dict(sorted(mapping, key=operator.itemgetter(0)))
323323

324324
def __get_stubs_outputs(self):
325325
# assemble the base name for each extension that needs a stub

setuptools/command/build_py.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ def get_output_mapping(self) -> dict[str, str]:
153153
self._get_package_data_output_mapping(),
154154
self._get_module_mapping(),
155155
)
156-
return dict(sorted(mapping, key=lambda x: x[0]))
156+
return dict(sorted(mapping, key=operator.itemgetter(0)))
157157

158158
def _get_module_mapping(self) -> Iterator[tuple[str, str]]:
159159
"""Iterate over all modules producing (dest, src) pairs."""

setuptools/command/editable_wheel.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -865,7 +865,7 @@ def _finder_template(
865865
"""Create a string containing the code for the``MetaPathFinder`` and
866866
``PathEntryFinder``.
867867
"""
868-
mapping = dict(sorted(mapping.items(), key=lambda p: p[0]))
868+
mapping = dict(sorted(mapping.items(), key=operator.itemgetter(0)))
869869
return _FINDER_TEMPLATE.format(name=name, mapping=mapping, namespaces=namespaces)
870870

871871

0 commit comments

Comments
 (0)