Skip to content

Commit

Permalink
Extract existing names lookup into a variable once again. Fixes #43.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Feb 17, 2020
1 parent ae5966e commit 7a01861
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions zipp.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,12 @@ class CompleteDirs(zipfile.ZipFile):
@staticmethod
def _implied_dirs(names):
parents = itertools.chain.from_iterable(map(_parents, names))
# Cast names to a set for O(1) lookups
existing = set(names)
# Deduplicate entries in original order
implied_dirs = OrderedDict.fromkeys(
p + posixpath.sep for p in parents
# Cast names to a set for O(1) lookups
if p + posixpath.sep not in set(names)
if p + posixpath.sep not in existing
)
return implied_dirs

Expand Down

0 comments on commit 7a01861

Please sign in to comment.