1
0
mirror of https://github.com/gryf/ebook-converter.git synced 2026-04-07 21:43:31 +02:00

Removed overwritten builtins from mosto of the files.

Just started the process of cleaning up the code base.
This commit is contained in:
2020-04-19 19:06:09 +02:00
parent 571da747b3
commit b66cbd2c1e
95 changed files with 167 additions and 269 deletions

View File

@@ -6,10 +6,13 @@ __docformat__ = 'restructuredtext en'
Perform various initialization tasks.
'''
import locale, sys, os
import builtins
import locale
import sys
import os
# Default translation is NOOP
from ebook_converter.polyglot.builtins import builtins, is_py3, unicode_type
from ebook_converter.polyglot.builtins import is_py3
builtins.__dict__['_'] = lambda s: s
# For strings which belong in the translation tables, but which shouldn't be
@@ -75,7 +78,7 @@ if not _run_once:
winutil, winutilerror = plugins['winutil']
if not winutil:
raise RuntimeError('Failed to load the winutil plugin: %s'%winutilerror)
if len(sys.argv) > 1 and not isinstance(sys.argv[1], unicode_type):
if len(sys.argv) > 1 and not isinstance(sys.argv[1], str):
sys.argv[1:] = winutil.argv()[1-len(sys.argv):]
if not ispy3:
@@ -110,7 +113,7 @@ if not _run_once:
if isosx:
enc = 'utf-8'
for i in range(1, len(sys.argv)):
if not isinstance(sys.argv[i], unicode_type):
if not isinstance(sys.argv[i], str):
sys.argv[i] = sys.argv[i].decode(enc, 'replace')
#
@@ -239,7 +242,7 @@ if not _run_once:
if name == 'Thread':
name = self.name
if name:
if isinstance(name, unicode_type):
if isinstance(name, str):
name = name.encode('ascii', 'replace').decode('ascii')
plugins['speedup'][0].set_thread_name(name[:15])
except Exception: