Skip to content

Commit b33e791

Browse files
authored
Merge pull request pypa#9375 from jdufresne/dict-set-comprehension
Use dict and set comprehension where available
2 parents 14830ae + 156886c commit b33e791

File tree

3 files changed

+3
-4
lines changed

3 files changed

+3
-4
lines changed

news/24193261-eaf9-4117-a1a9-d5bb7f93b447.trivial.rst

Whitespace-only changes.

src/pip/_internal/req/req_uninstall.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,9 @@ def compress_for_rename(paths):
129129
This set may include directories when the original sequence of paths
130130
included every file on disk.
131131
"""
132-
case_map = dict((os.path.normcase(p), p) for p in paths)
132+
case_map = {os.path.normcase(p): p for p in paths}
133133
remaining = set(case_map)
134-
unchecked = sorted(set(os.path.split(p)[0]
135-
for p in case_map.values()), key=len)
134+
unchecked = sorted({os.path.split(p)[0] for p in case_map.values()}, key=len)
136135
wildcards = set() # type: Set[str]
137136

138137
def norm_join(*a):

src/pip/_internal/utils/wheel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ def wheel_dist_info_dir(source, name):
114114
it doesn't match the provided name.
115115
"""
116116
# Zip file path separators must be /
117-
subdirs = set(p.split("/", 1)[0] for p in source.namelist())
117+
subdirs = {p.split("/", 1)[0] for p in source.namelist()}
118118

119119
info_dirs = [s for s in subdirs if s.endswith('.dist-info')]
120120

0 commit comments

Comments
 (0)