1
0
mirror of https://github.com/gryf/ebook-converter.git synced 2026-04-07 05:23:34 +02:00

Removed polyglots unicode_type usage

This commit is contained in:
2020-04-20 19:25:28 +02:00
parent ef7e2b10be
commit 128705f258
130 changed files with 657 additions and 716 deletions

View File

@@ -9,7 +9,6 @@ from various formats.
import os, re, numbers, sys
from ebook_converter import prints
from ebook_converter.ebooks.chardet import xml_to_unicode
from ebook_converter.polyglot.builtins import unicode_type
class ConversionError(Exception):
@@ -80,7 +79,7 @@ def extract_calibre_cover(raw, base, log):
if matches is None:
body = soup.find('body')
if body is not None:
text = u''.join(map(unicode_type, body.findAll(text=True)))
text = u''.join(map(str, body.findAll(text=True)))
if text.strip():
# Body has text, abort
return
@@ -150,7 +149,7 @@ def check_ebook_format(stream, current_guess):
def normalize(x):
if isinstance(x, unicode_type):
if isinstance(x, str):
import unicodedata
x = unicodedata.normalize('NFC', x)
return x