Skip to content

Commit

Permalink
Apply ruff/flake8-comprehensions rule C417
Browse files Browse the repository at this point in the history
C417 Unnecessary `map` usage (rewrite using a generator expression)
  • Loading branch information
DimitriPapadopoulos committed Jan 5, 2025
1 parent a9dcb9b commit 2e7afb5
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion setuptools/dist.py
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,7 @@ def by_order(hook):

defined = metadata.entry_points(group=group)
filtered = itertools.filterfalse(self._removed, defined)
loaded = map(lambda e: e.load(), filtered)
loaded = (e.load() for e in filtered)
for ep in sorted(loaded, key=by_order):
ep(self)

Expand Down
2 changes: 1 addition & 1 deletion setuptools/tests/test_build_py.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ def test_existing_egg_info(tmpdir_cwd, monkeypatch):
assert build_py.data_files

# Make sure the list of outputs is actually OK
outputs = map(lambda x: x.replace(os.sep, "/"), build_py.get_outputs())
outputs = (x.replace(os.sep, "/") for x in build_py.get_outputs())
assert outputs
example = str(Path(build_py.build_lib, "mypkg/__init__.py")).replace(os.sep, "/")
assert example in outputs
Expand Down
2 changes: 1 addition & 1 deletion setuptools/tests/test_sdist.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ def test_defaults_case_sensitivity(self, source_dir):
# lowercase all names so we can test in a
# case-insensitive way to make sure the files
# are not included.
manifest = map(lambda x: x.lower(), cmd.filelist.files)
manifest = (x.lower() for x in cmd.filelist.files)
assert 'readme.rst' not in manifest, manifest
assert 'setup.py' not in manifest, manifest
assert 'setup.cfg' not in manifest, manifest
Expand Down

0 comments on commit 2e7afb5

Please sign in to comment.