mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Dont import lxml at top level of module
This commit is contained in:
parent
8d97c1021b
commit
e1383f51af
@ -30,7 +30,6 @@ from calibre.devices.usbms.driver import USBMS
|
|||||||
from calibre.ebooks import DRMError
|
from calibre.ebooks import DRMError
|
||||||
from calibre.ebooks.metadata import authors_to_string
|
from calibre.ebooks.metadata import authors_to_string
|
||||||
from calibre.ebooks.metadata.book.base import Metadata
|
from calibre.ebooks.metadata.book.base import Metadata
|
||||||
from calibre.ebooks.metadata.utils import normalize_languages
|
|
||||||
from calibre.prints import debug_print
|
from calibre.prints import debug_print
|
||||||
from calibre.ptempfile import PersistentTemporaryFile, TemporaryDirectory, better_mktemp
|
from calibre.ptempfile import PersistentTemporaryFile, TemporaryDirectory, better_mktemp
|
||||||
from calibre.utils.config_base import prefs
|
from calibre.utils.config_base import prefs
|
||||||
@ -3385,6 +3384,7 @@ class KOBOTOUCH(KOBO):
|
|||||||
debug_print('KoboTouch:set_series - end')
|
debug_print('KoboTouch:set_series - end')
|
||||||
|
|
||||||
def set_core_metadata(self, connection, book, series_only=False):
|
def set_core_metadata(self, connection, book, series_only=False):
|
||||||
|
from calibre.ebooks.metadata.utils import normalize_languages
|
||||||
# debug_print('KoboTouch:set_core_metadata book="%s"' % book.title)
|
# debug_print('KoboTouch:set_core_metadata book="%s"' % book.title)
|
||||||
show_debug = self.is_debugging_title(book.title)
|
show_debug = self.is_debugging_title(book.title)
|
||||||
if show_debug:
|
if show_debug:
|
||||||
|
@ -27,7 +27,6 @@ from calibre import as_unicode, browser, random_user_agent, xml_replace_entities
|
|||||||
from calibre.ebooks.metadata import check_isbn
|
from calibre.ebooks.metadata import check_isbn
|
||||||
from calibre.ebooks.metadata.book.base import Metadata
|
from calibre.ebooks.metadata.book.base import Metadata
|
||||||
from calibre.ebooks.metadata.sources.base import Option, Source, fixauthors, fixcase
|
from calibre.ebooks.metadata.sources.base import Option, Source, fixauthors, fixcase
|
||||||
from calibre.ebooks.oeb.base import urlquote
|
|
||||||
from calibre.utils.icu import lower as icu_lower
|
from calibre.utils.icu import lower as icu_lower
|
||||||
from calibre.utils.localization import canonicalize_lang
|
from calibre.utils.localization import canonicalize_lang
|
||||||
from calibre.utils.random_ua import accept_header_for_ua
|
from calibre.utils.random_ua import accept_header_for_ua
|
||||||
@ -51,6 +50,7 @@ def sort_matches_preferring_kindle_editions(matches):
|
|||||||
|
|
||||||
|
|
||||||
def iri_quote_plus(url):
|
def iri_quote_plus(url):
|
||||||
|
from calibre.ebooks.oeb.base import urlquote
|
||||||
ans = urlquote(url)
|
ans = urlquote(url)
|
||||||
if isinstance(ans, bytes):
|
if isinstance(ans, bytes):
|
||||||
ans = ans.decode('utf-8')
|
ans = ans.decode('utf-8')
|
||||||
|
@ -22,12 +22,9 @@ from enum import Enum, auto
|
|||||||
from functools import partial
|
from functools import partial
|
||||||
from math import ceil, floor, modf, trunc
|
from math import ceil, floor, modf, trunc
|
||||||
|
|
||||||
from lxml import html
|
|
||||||
|
|
||||||
from calibre import human_readable, prepare_string_for_xml, prints
|
from calibre import human_readable, prepare_string_for_xml, prints
|
||||||
from calibre.constants import DEBUG
|
from calibre.constants import DEBUG
|
||||||
from calibre.db.constants import DATA_DIR_NAME, DATA_FILE_PATTERN
|
from calibre.db.constants import DATA_DIR_NAME, DATA_FILE_PATTERN
|
||||||
from calibre.db.notes.exim import expand_note_resources, parse_html
|
|
||||||
from calibre.ebooks.metadata import title_sort
|
from calibre.ebooks.metadata import title_sort
|
||||||
from calibre.ebooks.metadata.book.base import field_metadata
|
from calibre.ebooks.metadata.book.base import field_metadata
|
||||||
from calibre.ebooks.metadata.search_internet import qquote
|
from calibre.ebooks.metadata.search_internet import qquote
|
||||||
@ -3095,6 +3092,9 @@ This function works only in the GUI and the content server.
|
|||||||
if plain_text == '1':
|
if plain_text == '1':
|
||||||
note = note['searchable_text'].partition('\n')[2]
|
note = note['searchable_text'].partition('\n')[2]
|
||||||
else:
|
else:
|
||||||
|
from lxml import html
|
||||||
|
|
||||||
|
from calibre.db.notes.exim import expand_note_resources, parse_html
|
||||||
# Return the full HTML of the note, including all images
|
# Return the full HTML of the note, including all images
|
||||||
# as data: URLs. Reason: non-exported note html contains
|
# as data: URLs. Reason: non-exported note html contains
|
||||||
# "calres://" URLs for images. These images won't render
|
# "calres://" URLs for images. These images won't render
|
||||||
|
Loading…
x
Reference in New Issue
Block a user