From 434df30acd39f412816773aca4a1d19e78a631be Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 14 Jun 2014 12:07:27 -0400 Subject: Rewrite construct/append loop with simple iterator. --- pkg_resources.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'pkg_resources.py') diff --git a/pkg_resources.py b/pkg_resources.py index d12e9353..ca29ed66 100644 --- a/pkg_resources.py +++ b/pkg_resources.py @@ -1569,13 +1569,15 @@ class ZipManifests(dict): zipinfo.date_time[4] << 5 | (zipinfo.date_time[5] // 2) * [7] - zipinfo.CRC """ - zipinfo = dict() with ContextualZipFile(path) as zfile: - for zitem in zfile.namelist(): - zpath = zitem.replace('/', os.sep) - zipinfo[zpath] = zfile.getinfo(zitem) - assert zipinfo[zpath] is not None - return zipinfo + items = ( + ( + name.replace('/', os.sep), + zfile.getinfo(name), + ) + for name in zfile.namelist() + ) + return dict(items) build_zipmanifest = ZipManifests() -- cgit v1.2.3