mirror of
https://github.com/gryf/ebook-converter.git
synced 2026-01-10 21:54:11 +01:00
Cut off cross importing things.
There was (and perhaps it exists in other modules, need to check) a bad habit of importing objects out of module A into B just to be able of import those object from module B. In this case there was import from module config_base into module config. This commit fix this.
This commit is contained in:
@@ -12,6 +12,7 @@ from ebook_converter.customize import profiles
|
||||
from ebook_converter.customize import builtins
|
||||
from ebook_converter.ebooks import metadata
|
||||
from ebook_converter.utils import config as cfg
|
||||
from ebook_converter.utils import config_base
|
||||
|
||||
|
||||
builtin_names = frozenset(p.name for p in builtins.plugins)
|
||||
@@ -23,7 +24,7 @@ class NameConflict(ValueError):
|
||||
|
||||
|
||||
def _config():
|
||||
c = cfg.Config('customize')
|
||||
c = config_base.Config('customize')
|
||||
c.add_opt('plugins', default={}, help='Installed plugins')
|
||||
c.add_opt('filetype_mapping', default={},
|
||||
help='Mapping for filetype plugins')
|
||||
@@ -32,7 +33,7 @@ def _config():
|
||||
c.add_opt('disabled_plugins', default=set(), help='Disabled plugins')
|
||||
c.add_opt('enabled_plugins', default=set(), help='Enabled plugins')
|
||||
|
||||
return cfg.ConfigProxy(c)
|
||||
return config_base.ConfigProxy(c)
|
||||
|
||||
|
||||
config = _config()
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import os, re, collections
|
||||
|
||||
from ebook_converter.utils.config import prefs
|
||||
from ebook_converter.utils.config_base import prefs
|
||||
from ebook_converter.constants_old import filesystem_encoding
|
||||
from ebook_converter.ebooks.metadata.opf2 import OPF
|
||||
from ebook_converter.customize.ui import get_file_type_metadata, set_file_type_metadata
|
||||
|
||||
@@ -33,7 +33,7 @@ from ebook_converter.ebooks.metadata.book.base import Metadata
|
||||
from ebook_converter.utils.date import parse_date, isoformat
|
||||
from ebook_converter.utils.localization import get_lang, canonicalize_lang
|
||||
from ebook_converter.utils.cleantext import clean_ascii_chars, clean_xml_chars
|
||||
from ebook_converter.utils.config import tweaks
|
||||
from ebook_converter.utils.config_base import tweaks
|
||||
from ebook_converter.polyglot.urllib import unquote
|
||||
|
||||
|
||||
@@ -504,7 +504,7 @@ class TitleSortField(MetadataField):
|
||||
|
||||
def serialize_user_metadata(metadata_elem, all_user_metadata,
|
||||
tail='\n'+(' '*8)):
|
||||
from ebook_converter.utils.config import to_json
|
||||
from ebook_converter.utils.config_base import to_json
|
||||
from ebook_converter.ebooks.metadata.book.json_codec import \
|
||||
object_to_unicode, encode_is_multiple
|
||||
|
||||
@@ -654,7 +654,7 @@ class OPF(object): # {{{
|
||||
def read_user_metadata(self):
|
||||
self._user_metadata_ = {}
|
||||
temp = Metadata('x', ['x'])
|
||||
from ebook_converter.utils.config import from_json
|
||||
from ebook_converter.utils.config_base import from_json
|
||||
from ebook_converter.ebooks.metadata.book.json_codec import \
|
||||
decode_is_multiple
|
||||
elems = self.root.xpath('//*[name() = "meta" and starts-with(@name,'
|
||||
|
||||
@@ -18,7 +18,7 @@ from ebook_converter.ebooks.metadata.utils import (
|
||||
create_manifest_item, ensure_unique, normalize_languages, parse_opf,
|
||||
pretty_print_opf
|
||||
)
|
||||
from ebook_converter.utils.config import from_json, to_json
|
||||
from ebook_converter.utils.config_base import from_json, to_json
|
||||
from ebook_converter.utils.date import (fix_only_date, is_date_undefined,
|
||||
isoformat, parse_date as parse_date_,
|
||||
utcnow, w3cdtf)
|
||||
|
||||
@@ -173,7 +173,7 @@ def read_series(root):
|
||||
|
||||
|
||||
def read_user_metadata(mi, root):
|
||||
from ebook_converter.utils.config import from_json
|
||||
from ebook_converter.utils.config_base import from_json
|
||||
from ebook_converter.ebooks.metadata.book.json_codec import \
|
||||
decode_is_multiple
|
||||
fields = set()
|
||||
@@ -452,7 +452,7 @@ def create_series(calibre, series, series_index):
|
||||
|
||||
|
||||
def create_user_metadata(calibre, all_user_metadata):
|
||||
from ebook_converter.utils.config import to_json
|
||||
from ebook_converter.utils.config_base import to_json
|
||||
from ebook_converter.ebooks.metadata.book.json_codec import \
|
||||
object_to_unicode, encode_is_multiple
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ __copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
def db(path=None, read_only=False):
|
||||
from ebook_converter.db.legacy import LibraryDatabase
|
||||
from ebook_converter.utils.config import prefs
|
||||
from ebook_converter.utils.config_base import prefs
|
||||
return LibraryDatabase(os.path.expanduser(path) if path else prefs['library_path'],
|
||||
read_only=read_only)
|
||||
|
||||
@@ -69,7 +69,7 @@ def generate_test_db(library_path, # {{{
|
||||
|
||||
|
||||
def current_library_path():
|
||||
from ebook_converter.utils.config import prefs
|
||||
from ebook_converter.utils.config_base import prefs
|
||||
path = prefs['library_path']
|
||||
if path:
|
||||
path = path.replace('\\', '/')
|
||||
|
||||
@@ -7,17 +7,7 @@ from copy import deepcopy
|
||||
|
||||
from ebook_converter import constants
|
||||
from ebook_converter import constants_old
|
||||
from ebook_converter.utils.config_base import (
|
||||
Config, ConfigInterface, ConfigProxy, Option, OptionSet, OptionValues,
|
||||
StringConfig, json_dumps, json_loads, make_config_dir, plugin_dir, prefs,
|
||||
tweaks, from_json, to_json
|
||||
)
|
||||
|
||||
|
||||
if False:
|
||||
# Make pyflakes happy
|
||||
Config, ConfigProxy, Option, OptionValues, StringConfig, OptionSet,
|
||||
ConfigInterface, tweaks, plugin_dir, prefs, from_json, to_json
|
||||
from ebook_converter.utils.config_base import json_dumps, json_loads
|
||||
|
||||
|
||||
def check_config_write_access():
|
||||
|
||||
@@ -9,7 +9,7 @@ from math import trunc
|
||||
from ebook_converter import human_readable
|
||||
from ebook_converter.constants_old import DEBUG
|
||||
from ebook_converter.ebooks.metadata import title_sort
|
||||
from ebook_converter.utils.config import tweaks
|
||||
from ebook_converter.utils.config_base import tweaks
|
||||
from ebook_converter.utils.titlecase import titlecase
|
||||
from ebook_converter.utils.icu import capitalize, strcmp, sort_key
|
||||
from ebook_converter.utils.date import parse_date, format_date, now, UNDEFINED_DATE
|
||||
|
||||
Reference in New Issue
Block a user