Skip to content

Commit 2e7afb5

Browse files
Apply ruff/flake8-comprehensions rule C417
C417 Unnecessary `map` usage (rewrite using a generator expression)
1 parent a9dcb9b commit 2e7afb5

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

setuptools/dist.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,7 @@ def by_order(hook):
670670

671671
defined = metadata.entry_points(group=group)
672672
filtered = itertools.filterfalse(self._removed, defined)
673-
loaded = map(lambda e: e.load(), filtered)
673+
loaded = (e.load() for e in filtered)
674674
for ep in sorted(loaded, key=by_order):
675675
ep(self)
676676

setuptools/tests/test_build_py.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ def test_existing_egg_info(tmpdir_cwd, monkeypatch):
244244
assert build_py.data_files
245245

246246
# Make sure the list of outputs is actually OK
247-
outputs = map(lambda x: x.replace(os.sep, "/"), build_py.get_outputs())
247+
outputs = (x.replace(os.sep, "/") for x in build_py.get_outputs())
248248
assert outputs
249249
example = str(Path(build_py.build_lib, "mypkg/__init__.py")).replace(os.sep, "/")
250250
assert example in outputs

setuptools/tests/test_sdist.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ def test_defaults_case_sensitivity(self, source_dir):
419419
# lowercase all names so we can test in a
420420
# case-insensitive way to make sure the files
421421
# are not included.
422-
manifest = map(lambda x: x.lower(), cmd.filelist.files)
422+
manifest = (x.lower() for x in cmd.filelist.files)
423423
assert 'readme.rst' not in manifest, manifest
424424
assert 'setup.py' not in manifest, manifest
425425
assert 'setup.cfg' not in manifest, manifest

0 commit comments

Comments
 (0)