From a5880b24453832b2605553f0e675c52d55dfdb3f Mon Sep 17 00:00:00 2001 From: gryf Date: Wed, 30 Sep 2020 20:22:20 +0200 Subject: [PATCH] Moving dependent function my_unichar into entity_to_unicode function --- ebook_converter/__init__.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/ebook_converter/__init__.py b/ebook_converter/__init__.py index 0151c81..13f8fae 100644 --- a/ebook_converter/__init__.py +++ b/ebook_converter/__init__.py @@ -107,13 +107,6 @@ def walk(dir): yield os.path.join(record[0], f) -def my_unichr(num): - try: - return chr(num) - except (ValueError, OverflowError): - return '?' - - def entity_to_unicode(match, exceptions=[], encoding='cp1252', result_exceptions={}): """ @@ -134,6 +127,12 @@ def entity_to_unicode(match, exceptions=[], encoding='cp1252', actual entities. """ + def my_unichr(num): + try: + return chr(num) + except (ValueError, OverflowError): + return '?' + def check(ch): return result_exceptions.get(ch, ch)