mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-06-22 14:03:06 +03:00
Various health fixes
This commit is contained in:
parent
b213f63c59
commit
f55f2d13cb
|
@ -517,7 +517,7 @@ def filetime2datetime(filetime):
|
||||||
|
|
||||||
#=== CLASSES ==================================================================
|
#=== CLASSES ==================================================================
|
||||||
|
|
||||||
class OleMetadata:
|
class OleMetadata(object):
|
||||||
"""
|
"""
|
||||||
class to parse and store metadata from standard properties of OLE files.
|
class to parse and store metadata from standard properties of OLE files.
|
||||||
|
|
||||||
|
@ -803,7 +803,7 @@ class _OleStream(io.BytesIO):
|
||||||
|
|
||||||
#--- _OleDirectoryEntry -------------------------------------------------------
|
#--- _OleDirectoryEntry -------------------------------------------------------
|
||||||
|
|
||||||
class _OleDirectoryEntry:
|
class _OleDirectoryEntry(object):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
OLE2 Directory Entry
|
OLE2 Directory Entry
|
||||||
|
@ -1064,7 +1064,7 @@ class _OleDirectoryEntry:
|
||||||
|
|
||||||
#--- OleFileIO ----------------------------------------------------------------
|
#--- OleFileIO ----------------------------------------------------------------
|
||||||
|
|
||||||
class OleFileIO:
|
class OleFileIO(object):
|
||||||
"""
|
"""
|
||||||
OLE container object
|
OLE container object
|
||||||
|
|
||||||
|
@ -1935,12 +1935,12 @@ class OleFileIO:
|
||||||
nb_sectors = (size + (self.sectorsize-1)) // self.sectorsize
|
nb_sectors = (size + (self.sectorsize-1)) // self.sectorsize
|
||||||
debug('nb_sectors = %d' % nb_sectors)
|
debug('nb_sectors = %d' % nb_sectors)
|
||||||
for i in range(nb_sectors):
|
for i in range(nb_sectors):
|
||||||
## try:
|
# try:
|
||||||
## self.fp.seek(offset + self.sectorsize * sect)
|
# self.fp.seek(offset + self.sectorsize * sect)
|
||||||
## except:
|
# except:
|
||||||
## debug('sect=%d, seek=%d' %
|
# debug('sect=%d, seek=%d' %
|
||||||
## (sect, offset+self.sectorsize*sect))
|
# (sect, offset+self.sectorsize*sect))
|
||||||
## raise IOError('OLE sector index out of range')
|
# raise IOError('OLE sector index out of range')
|
||||||
# extract one sector from data, the last one being smaller:
|
# extract one sector from data, the last one being smaller:
|
||||||
if i<(nb_sectors-1):
|
if i<(nb_sectors-1):
|
||||||
data_sector = data [i*self.sectorsize : (i+1)*self.sectorsize]
|
data_sector = data [i*self.sectorsize : (i+1)*self.sectorsize]
|
||||||
|
@ -2071,7 +2071,7 @@ class OleFileIO:
|
||||||
"""
|
"""
|
||||||
#REFERENCE: [MS-OLEPS] https://msdn.microsoft.com/en-us/library/dd942421.aspx
|
#REFERENCE: [MS-OLEPS] https://msdn.microsoft.com/en-us/library/dd942421.aspx
|
||||||
# make sure no_conversion is a list, just to simplify code below:
|
# make sure no_conversion is a list, just to simplify code below:
|
||||||
if no_conversion == None:
|
if no_conversion is None:
|
||||||
no_conversion = []
|
no_conversion = []
|
||||||
# stream path as a string to report exceptions:
|
# stream path as a string to report exceptions:
|
||||||
streampath = filename
|
streampath = filename
|
||||||
|
@ -2226,8 +2226,6 @@ class OleFileIO:
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
||||||
import sys
|
|
||||||
|
|
||||||
# [PL] display quick usage info if launched from command-line
|
# [PL] display quick usage info if launched from command-line
|
||||||
if len(sys.argv) <= 1:
|
if len(sys.argv) <= 1:
|
||||||
print('olefile version %s %s - %s' % (__version__, __date__, __author__))
|
print('olefile version %s %s - %s' % (__version__, __date__, __author__))
|
||||||
|
@ -2247,7 +2245,7 @@ For more information, see http://www.decalage.info/olefile
|
||||||
|
|
||||||
check_streams = False
|
check_streams = False
|
||||||
for filename in sys.argv[1:]:
|
for filename in sys.argv[1:]:
|
||||||
## try:
|
# try:
|
||||||
# OPTIONS:
|
# OPTIONS:
|
||||||
if filename == '-d':
|
if filename == '-d':
|
||||||
# option to switch debug mode on:
|
# option to switch debug mode on:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user