mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Micro optimisation
This commit is contained in:
parent
b4251ab1be
commit
d7d5144790
@ -1107,13 +1107,16 @@ class ZipFile:
|
||||
'''
|
||||
if members is None:
|
||||
members = self.namelist()
|
||||
if path is None:
|
||||
path = os.getcwd()
|
||||
|
||||
# Kovid: Extract longer names first, just in case the zip file has
|
||||
# an entry for a directory without a trailing slash
|
||||
members.sort(key=len, reverse=True)
|
||||
zimembers = tuple(map(self.getinfo, members))
|
||||
|
||||
for zipinfo in members:
|
||||
self.extract(zipinfo, path, pwd)
|
||||
for zipinfo in zimembers:
|
||||
self._extract_member(zipinfo, path, pwd)
|
||||
|
||||
def _extract_member(self, member, targetpath, pwd):
|
||||
'''Extract the ZipInfo object 'member' to a physical
|
||||
|
Loading…
x
Reference in New Issue
Block a user