Skip to content

Commit

Permalink
Enforce ruff/refurb rule FURB118
Browse files Browse the repository at this point in the history
FURB118 Use `operator.itemgetter(0)` instead of defining a lambda
  • Loading branch information
DimitriPapadopoulos committed Aug 18, 2024
1 parent e9bc9c4 commit 3477d01
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion setuptools/command/build_ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion setuptools/command/build_py.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand Down
2 changes: 1 addition & 1 deletion setuptools/command/editable_wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)


Expand Down

0 comments on commit 3477d01

Please sign in to comment.