mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 18:24:30 -04:00
pep8
This commit is contained in:
parent
e18c846e22
commit
8d52fc6fd9
@ -95,7 +95,6 @@ class SecondaryIndexHeader(object): # {{{
|
|||||||
if idxt[6:].replace(b'\0', b''):
|
if idxt[6:].replace(b'\0', b''):
|
||||||
raise ValueError('Non null trailing bytes after IDXT')
|
raise ValueError('Non null trailing bytes after IDXT')
|
||||||
|
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
ans = ['*'*20 + ' Secondary Index Header '+ '*'*20]
|
ans = ['*'*20 + ' Secondary Index Header '+ '*'*20]
|
||||||
a = ans.append
|
a = ans.append
|
||||||
@ -196,7 +195,6 @@ class IndexHeader(object): # {{{
|
|||||||
if idxt[6:].replace(b'\0', b''):
|
if idxt[6:].replace(b'\0', b''):
|
||||||
raise ValueError('Non null trailing bytes after IDXT')
|
raise ValueError('Non null trailing bytes after IDXT')
|
||||||
|
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
ans = ['*'*20 + ' Index Header (%d bytes)'%len(self.record.raw)+ '*'*20]
|
ans = ['*'*20 + ' Index Header (%d bytes)'%len(self.record.raw)+ '*'*20]
|
||||||
a = ans.append
|
a = ans.append
|
||||||
@ -555,7 +553,8 @@ class TBSIndexing(object): # {{{
|
|||||||
|
|
||||||
def get_index(self, idx):
|
def get_index(self, idx):
|
||||||
for i in self.indices:
|
for i in self.indices:
|
||||||
if i.index in {idx, unicode(idx)}: return i
|
if i.index in {idx, unicode(idx)}:
|
||||||
|
return i
|
||||||
raise IndexError('Index %d not found'%idx)
|
raise IndexError('Index %d not found'%idx)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
@ -568,7 +567,8 @@ class TBSIndexing(object): # {{{
|
|||||||
types = defaultdict(list)
|
types = defaultdict(list)
|
||||||
for r, dat in self.record_indices.iteritems():
|
for r, dat in self.record_indices.iteritems():
|
||||||
tbs_type, strings = self.dump_record(r, dat)
|
tbs_type, strings = self.dump_record(r, dat)
|
||||||
if tbs_type == 0: continue
|
if tbs_type == 0:
|
||||||
|
continue
|
||||||
types[tbs_type] += strings
|
types[tbs_type] += strings
|
||||||
for typ, strings in types.iteritems():
|
for typ, strings in types.iteritems():
|
||||||
with open(os.path.join(bdir, 'tbs_type_%d.txt'%typ), 'wb') as f:
|
with open(os.path.join(bdir, 'tbs_type_%d.txt'%typ), 'wb') as f:
|
||||||
@ -742,7 +742,6 @@ class MOBIFile(object): # {{{
|
|||||||
self.records[sir+1:sir+1+numi], self.secondary_index_header, self.cncx)
|
self.records[sir+1:sir+1+numi], self.secondary_index_header, self.cncx)
|
||||||
self.indexing_record_nums |= set(xrange(sir+1, sir+1+numi))
|
self.indexing_record_nums |= set(xrange(sir+1, sir+1+numi))
|
||||||
|
|
||||||
|
|
||||||
ntr = self.mobi_header.number_of_text_records
|
ntr = self.mobi_header.number_of_text_records
|
||||||
fntbr = self.mobi_header.first_non_book_record
|
fntbr = self.mobi_header.first_non_book_record
|
||||||
fii = self.mobi_header.first_image_index
|
fii = self.mobi_header.first_image_index
|
||||||
|
Loading…
x
Reference in New Issue
Block a user