mirror of
https://github.com/gryf/ebook-converter.git
synced 2026-03-31 01:13:32 +02:00
Removed polyglots unicode_type usage
This commit is contained in:
@@ -2,7 +2,6 @@ import os, sys, zipfile, importlib
|
||||
|
||||
from ebook_converter.constants import numeric_version, iswindows, isosx
|
||||
from ebook_converter.ptempfile import PersistentTemporaryFile
|
||||
from ebook_converter.polyglot.builtins import unicode_type
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
@@ -196,7 +195,7 @@ class Plugin(object): # {{{
|
||||
config_dialog.exec_()
|
||||
|
||||
if config_dialog.result() == QDialog.Accepted:
|
||||
sc = unicode_type(sc.text()).strip()
|
||||
sc = str(sc.text()).strip()
|
||||
customize_plugin(self, sc)
|
||||
|
||||
geom = bytearray(config_dialog.saveGeometry())
|
||||
|
||||
@@ -5,7 +5,6 @@ import re, os, shutil, numbers
|
||||
|
||||
from ebook_converter import CurrentDir
|
||||
from ebook_converter.customize import Plugin
|
||||
from ebook_converter.polyglot.builtins import unicode_type
|
||||
|
||||
|
||||
class ConversionOption(object):
|
||||
@@ -79,7 +78,7 @@ class OptionRecommendation(object):
|
||||
self.option.choices:
|
||||
raise ValueError('OpRec: %s: Recommended value not in choices'%
|
||||
self.option.name)
|
||||
if not (isinstance(self.recommended_value, (numbers.Number, bytes, unicode_type)) or self.recommended_value is None):
|
||||
if not (isinstance(self.recommended_value, (numbers.Number, bytes, str)) or self.recommended_value is None):
|
||||
raise ValueError('OpRec: %s:'%self.option.name + repr(
|
||||
self.recommended_value) + ' is not a string or a number')
|
||||
|
||||
@@ -298,7 +297,7 @@ class OutputFormatPlugin(Plugin):
|
||||
@property
|
||||
def is_periodical(self):
|
||||
return self.oeb.metadata.publication_type and \
|
||||
unicode_type(self.oeb.metadata.publication_type[0]).startswith('periodical:')
|
||||
str(self.oeb.metadata.publication_type[0]).startswith('periodical:')
|
||||
|
||||
def specialize_options(self, log, opts, input_fmt):
|
||||
'''
|
||||
|
||||
@@ -18,7 +18,7 @@ from ebook_converter.utils.config import (make_config_dir, Config, ConfigProxy,
|
||||
plugin_dir, OptionParser)
|
||||
# from ebook_converter.ebooks.metadata.sources.base import Source
|
||||
from ebook_converter.constants import DEBUG, numeric_version
|
||||
from ebook_converter.polyglot.builtins import iteritems, itervalues, unicode_type
|
||||
from ebook_converter.polyglot.builtins import iteritems, itervalues
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
@@ -740,7 +740,7 @@ def build_plugin(path):
|
||||
from ebook_converter import prints
|
||||
from ebook_converter.ptempfile import PersistentTemporaryFile
|
||||
from ebook_converter.utils.zipfile import ZipFile, ZIP_STORED
|
||||
path = unicode_type(path)
|
||||
path = str(path)
|
||||
names = frozenset(os.listdir(path))
|
||||
if '__init__.py' not in names:
|
||||
prints(path, ' is not a valid plugin')
|
||||
|
||||
@@ -12,7 +12,7 @@ from ebook_converter.constants import ispy3
|
||||
from ebook_converter.customize import (Plugin, numeric_version, platform,
|
||||
InvalidPlugin, PluginNotFound)
|
||||
from ebook_converter.polyglot.builtins import (itervalues, string_or_bytes,
|
||||
unicode_type, reload)
|
||||
reload)
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
@@ -215,7 +215,7 @@ class PluginLoader(object):
|
||||
if ans.minimum_calibre_version > numeric_version:
|
||||
raise InvalidPlugin(
|
||||
'The plugin at %s needs a version of calibre >= %s' %
|
||||
(as_unicode(path_to_zip_file), '.'.join(map(unicode_type,
|
||||
(as_unicode(path_to_zip_file), '.'.join(map(str,
|
||||
ans.minimum_calibre_version))))
|
||||
|
||||
if platform not in ans.supported_platforms:
|
||||
@@ -230,7 +230,7 @@ class PluginLoader(object):
|
||||
raise
|
||||
|
||||
def _locate_code(self, zf, path_to_zip_file):
|
||||
names = [x if isinstance(x, unicode_type) else x.decode('utf-8') for x in
|
||||
names = [x if isinstance(x, str) else x.decode('utf-8') for x in
|
||||
zf.namelist()]
|
||||
names = [x[1:] if x[0] == '/' else x for x in names]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user