mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 10:14:46 -04:00
py3: get rid of more cStringIO
This commit is contained in:
parent
a754bf46f1
commit
d59d91374a
@ -8,9 +8,8 @@ __license__ = 'GPL v3'
|
||||
__copyright__ = '2009, John Schember <john@nachtimwald.com>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
import struct
|
||||
import struct, io
|
||||
|
||||
from cStringIO import StringIO
|
||||
|
||||
from calibre.ebooks.pdb.formatreader import FormatReader
|
||||
|
||||
@ -53,7 +52,7 @@ class Reader(FormatReader):
|
||||
return ''
|
||||
|
||||
def extract_content(self, output_dir):
|
||||
raw_txt = ''
|
||||
raw_txt = b''
|
||||
|
||||
self.log.info('Decompressing text...')
|
||||
for i in range(1, self.header_record.num_records + 1):
|
||||
@ -61,7 +60,7 @@ class Reader(FormatReader):
|
||||
raw_txt += self.decompress_text(i)
|
||||
|
||||
self.log.info('Converting text to OEB...')
|
||||
stream = StringIO(raw_txt)
|
||||
stream = io.BytesIO(raw_txt)
|
||||
|
||||
from calibre.customize.ui import plugin_for_input_format
|
||||
|
||||
|
@ -10,8 +10,8 @@ __docformat__ = 'restructuredtext en'
|
||||
|
||||
import struct
|
||||
import zlib
|
||||
import io
|
||||
|
||||
from cStringIO import StringIO
|
||||
|
||||
from calibre.ebooks.pdb.formatreader import FormatReader
|
||||
from calibre.ebooks.pdb.ztxt import zTXTError
|
||||
@ -72,7 +72,7 @@ class Reader(FormatReader):
|
||||
return self.uncompressor.decompress(self.section_data(number))
|
||||
|
||||
def extract_content(self, output_dir):
|
||||
raw_txt = ''
|
||||
raw_txt = b''
|
||||
|
||||
self.log.info('Decompressing text...')
|
||||
for i in range(1, self.header_record.num_records + 1):
|
||||
@ -80,7 +80,7 @@ class Reader(FormatReader):
|
||||
raw_txt += self.decompress_text(i)
|
||||
|
||||
self.log.info('Converting text to OEB...')
|
||||
stream = StringIO(raw_txt)
|
||||
stream = io.BytesIO(raw_txt)
|
||||
|
||||
from calibre.customize.ui import plugin_for_input_format
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user