1
0
mirror of https://github.com/gryf/ebook-converter.git synced 2026-04-07 21:43:31 +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

@@ -4,7 +4,7 @@ import unicodedata
# Setup code {{{
from ebook_converter.constants import plugins
from ebook_converter.polyglot.builtins import unicode_type, cmp
from ebook_converter.polyglot.builtins import cmp
from ebook_converter.utils.config_base import tweaks
@@ -250,7 +250,7 @@ ord_string = str # _icu.ord_string
def character_name(string):
try:
return _icu.character_name(unicode_type(string)) or None
return _icu.character_name(str(string)) or None
except (TypeError, ValueError, KeyError):
pass
@@ -267,8 +267,8 @@ def normalize(text, mode='NFC'):
# that unless you have very good reasons not too. Also, it's speed
# decreases on wide python builds, where conversion to/from ICU's string
# representation is slower.
# return _icu.normalize(_nmodes[mode], unicode_type(text))
return unicode.normalize(mode, unicode_type(text))
# return _icu.normalize(_nmodes[mode], str(text))
return unicode.normalize(mode, str(text))
def contractions(col=None):