1
0
mirror of https://github.com/gryf/ebook-converter.git synced 2026-04-20 05:03:35 +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

@@ -1,5 +1,4 @@
from struct import pack, unpack_from
from ebook_converter.polyglot.builtins import unicode_type
__license__ = 'GPL v3'
@@ -68,7 +67,7 @@ class ByteCode(dict):
return float(number), index
def write_float(self, f, encoding='ignored'):
s = unicode_type(f).upper()
s = str(f).upper()
if s[:2] == "0.":
s = s[1:]
elif s[:3] == "-0.":

View File

@@ -6,7 +6,7 @@ from functools import partial
from ebook_converter.utils.icu import safe_chr, ord_string
from ebook_converter.utils.fonts.sfnt.container import Sfnt
from ebook_converter.utils.fonts.sfnt.errors import UnsupportedFont, NoGlyphs
from ebook_converter.polyglot.builtins import unicode_type, iteritems, itervalues
from ebook_converter.polyglot.builtins import iteritems, itervalues
__license__ = 'GPL v3'
@@ -106,7 +106,7 @@ def pdf_subset(sfnt, glyphs):
def safe_ord(x):
return ord_string(unicode_type(x))[0]
return ord_string(str(x))[0]
def subset(raw, individual_chars, ranges=(), warnings=None):
@@ -343,12 +343,12 @@ def all():
print('No glyphs!')
continue
except UnsupportedFont as e:
unsupported.append((font['full_name'], font['path'], unicode_type(e)))
unsupported.append((font['full_name'], font['path'], str(e)))
print('Unsupported!')
continue
except Exception as e:
print('Failed!')
failed.append((font['full_name'], font['path'], unicode_type(e)))
failed.append((font['full_name'], font['path'], str(e)))
else:
averages.append(sum(itervalues(new_stats))/sum(itervalues(old_stats)) * 100)
print('Reduced to:', '%.1f'%averages[-1] , '%')