Add back Python2 support (ADEPT)

This commit is contained in:
NoDRM
2021-11-16 11:09:03 +01:00
parent 88dd1350c0
commit 90910ab106
21 changed files with 481 additions and 310 deletions

View File

@@ -209,6 +209,7 @@ def _EndRecData(fpin):
fpin.seek(-sizeEndCentDir, 2)
except IOError:
return None
data = fpin.read()
if data[0:4] == stringEndArchive and data[-2:] == "\000\000":
# the signature is correct and there's no comment, unpack structure
@@ -662,7 +663,8 @@ class ZipFile:
self.comment = b''
# Check if we were passed a file-like object
if isinstance(file, str):
# "str" is python3, "unicode" is python2
if isinstance(file, str) or isinstance(file, unicode):
self._filePassed = 0
self.filename = file
modeDict = {'r' : 'rb', 'w': 'wb', 'a' : 'r+b'}