mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 02:34:06 -04:00
pep8
This commit is contained in:
parent
7f3b6c1f7d
commit
fac9845f90
@ -265,7 +265,7 @@ class MetadataUpdater(object):
|
||||
|
||||
# Pad to a 4-byte boundary
|
||||
trail = len(new_record0.getvalue()) % 4
|
||||
pad = '\0' * (4 - trail) # Always pad w/ at least 1 byte
|
||||
pad = '\0' * (4 - trail) # Always pad w/ at least 1 byte
|
||||
new_record0.write(pad)
|
||||
new_record0.write('\0'*(1024*8))
|
||||
|
||||
@ -278,7 +278,8 @@ class MetadataUpdater(object):
|
||||
def hexdump(self, src, length=16):
|
||||
# Diagnostic
|
||||
FILTER=''.join([(len(repr(chr(x)))==3) and chr(x) or '.' for x in range(256)])
|
||||
N=0; result=''
|
||||
N=0
|
||||
result=''
|
||||
while src:
|
||||
s,src = src[:length],src[length:]
|
||||
hexa = ' '.join(["%02X"%ord(x) for x in s])
|
||||
@ -292,7 +293,7 @@ class MetadataUpdater(object):
|
||||
for i in xrange(self.nrecs):
|
||||
offset, a1,a2,a3,a4 = unpack('>LBBBB', self.data[78+i*8:78+i*8+8])
|
||||
flags, val = a1, a2<<16|a3<<8|a4
|
||||
pdbrecords.append( [offset, flags, val] )
|
||||
pdbrecords.append([offset, flags, val])
|
||||
return pdbrecords
|
||||
|
||||
def update_pdbrecords(self, updated_pdbrecords):
|
||||
@ -422,7 +423,7 @@ class MetadataUpdater(object):
|
||||
exth.write(data)
|
||||
exth = exth.getvalue()
|
||||
trail = len(exth) % 4
|
||||
pad = '\0' * (4 - trail) # Always pad w/ at least 1 byte
|
||||
pad = '\0' * (4 - trail) # Always pad w/ at least 1 byte
|
||||
exth = ['EXTH', pack('>II', len(exth) + 12, len(recs)), exth, pad]
|
||||
exth = ''.join(exth)
|
||||
|
||||
@ -474,7 +475,6 @@ def get_metadata(stream):
|
||||
except ImportError:
|
||||
import Image as PILImage
|
||||
|
||||
|
||||
stream.seek(0)
|
||||
try:
|
||||
raw = stream.read(3)
|
||||
@ -530,5 +530,3 @@ def get_metadata(stream):
|
||||
im.convert('RGB').save(obuf, format='JPEG')
|
||||
mi.cover_data = ('jpg', obuf.getvalue())
|
||||
return mi
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user