mirror of
https://github.com/gryf/ebook-converter.git
synced 2026-03-24 19:33:33 +01:00
Removed another unicode/string nonsense
This commit is contained in:
@@ -1,11 +1,3 @@
|
||||
from ebook_converter.polyglot.builtins import native_string_type
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2011, Kovid Goyal <kovid@kovidgoyal.net>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
|
||||
class ConversionUserFeedBack(Exception):
|
||||
|
||||
def __init__(self, title, msg, level='info', det_msg=''):
|
||||
@@ -25,4 +17,4 @@ class ConversionUserFeedBack(Exception):
|
||||
|
||||
# Ensure exception uses fully qualified name as this is used to detect it in
|
||||
# the GUI.
|
||||
ConversionUserFeedBack.__name__ = native_string_type('ebook_converter.ebooks.conversion.ConversionUserFeedBack')
|
||||
ConversionUserFeedBack.__name__ = 'ebook_converter.ebooks.conversion.ConversionUserFeedBack'
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
import re
|
||||
|
||||
from ebook_converter.ebooks.docx.index import process_index, polish_index_markup
|
||||
from ebook_converter.polyglot.builtins import native_string_type
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
|
||||
class Field(object):
|
||||
@@ -72,7 +67,7 @@ def parser(name, field_map, default_field_name=None):
|
||||
ans.pop(null, None)
|
||||
return ans
|
||||
|
||||
parse.__name__ = native_string_type('parse_' + name)
|
||||
parse.__name__ = 'parse_' + name
|
||||
|
||||
return parse
|
||||
|
||||
|
||||
@@ -11,11 +11,6 @@ from ebook_converter.ebooks.pdf.render.common import PAPER_SIZES
|
||||
from ebook_converter.utils.date import utcnow
|
||||
from ebook_converter.utils.localization import canonicalize_lang, lang_as_iso639_1
|
||||
from ebook_converter.utils.zipfile import ZipFile
|
||||
from ebook_converter.polyglot.builtins import native_string_type
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
|
||||
def xml2str(root, pretty_print=False, with_tail=False):
|
||||
@@ -237,7 +232,7 @@ class DOCX(object):
|
||||
namespaces = self.namespace.namespaces
|
||||
E = ElementMaker(namespace=namespaces['cp'], nsmap={x:namespaces[x] for x in 'cp dc dcterms xsi'.split()})
|
||||
cp = E.coreProperties(E.revision("1"), E.lastModifiedBy('calibre'))
|
||||
ts = utcnow().isoformat(native_string_type('T')).rpartition('.')[0] + 'Z'
|
||||
ts = utcnow().isoformat('T').rpartition('.')[0] + 'Z'
|
||||
for x in 'created modified'.split():
|
||||
x = cp.makeelement('{%s}%s' % (namespaces['dcterms'], x), **{'{%s}type' % namespaces['xsi']:'dcterms:W3CDTF'})
|
||||
x.text = ts
|
||||
|
||||
@@ -4,11 +4,6 @@ from ebook_converter.ebooks.lrf.fonts import get_font
|
||||
from ebook_converter.ebooks.lrf.pylrs.pylrs import TextBlock, Text, CR, Span, \
|
||||
CharButton, Plot, Paragraph, \
|
||||
LrsTextTag
|
||||
from ebook_converter.polyglot.builtins import native_string_type
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
|
||||
def ceil(num):
|
||||
@@ -17,8 +12,8 @@ def ceil(num):
|
||||
|
||||
def print_xml(elem):
|
||||
from ebook_converter.ebooks.lrf.pylrs.pylrs import ElementWriter
|
||||
elem = elem.toElement(native_string_type('utf8'))
|
||||
ew = ElementWriter(elem, sourceEncoding=native_string_type('utf8'))
|
||||
elem = elem.toElement('utf8')
|
||||
ew = ElementWriter(elem, sourceEncoding='utf8')
|
||||
ew.write(sys.stdout)
|
||||
print()
|
||||
|
||||
|
||||
@@ -51,7 +51,6 @@ DEFAULT_GENREADING = "fs" # default is yes to both lrf and lrs
|
||||
|
||||
from ebook_converter import __appname__, __version__
|
||||
from ebook_converter import entity_to_unicode
|
||||
from ebook_converter.polyglot.builtins import native_string_type
|
||||
|
||||
|
||||
class LrsError(Exception):
|
||||
@@ -617,7 +616,7 @@ class Book(Delegator):
|
||||
|
||||
_formatXml(root)
|
||||
tree = ElementTree(element=root)
|
||||
tree.write(f, encoding=native_string_type(outputEncodingName), xml_declaration=True)
|
||||
tree.write(f, encoding=outputEncodingName, xml_declaration=True)
|
||||
|
||||
|
||||
class BookInformation(Delegator):
|
||||
@@ -669,7 +668,7 @@ class Info(Delegator):
|
||||
# NB: generates an encoding attribute, which lrs2lrf does not
|
||||
tree = ElementTree(element=info)
|
||||
f = io.BytesIO()
|
||||
tree.write(f, encoding=native_string_type('utf-8'), xml_declaration=True)
|
||||
tree.write(f, encoding='utf-8', xml_declaration=True)
|
||||
xmlInfo = f.getvalue().decode('utf-8')
|
||||
xmlInfo = re.sub(r"<CThumbnail.*?>\n", "", xmlInfo)
|
||||
xmlInfo = xmlInfo.replace("SumPage>", "Page>")
|
||||
|
||||
@@ -9,7 +9,6 @@ from ebook_converter.constants import iswindows
|
||||
from ebook_converter.ptempfile import TemporaryDirectory
|
||||
from ebook_converter.ebooks.metadata import (
|
||||
MetaInformation, string_to_authors, check_isbn, check_doi)
|
||||
from ebook_converter.utils.ipc.simple_worker import fork_job, WorkerError
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
|
||||
Reference in New Issue
Block a user