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