mirror of
https://github.com/gryf/ebook-converter.git
synced 2026-04-26 16:41:29 +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:
@@ -1,24 +1,20 @@
|
||||
# License: GPLv3 Copyright: 2019, Kovid Goyal <kovid at kovidgoyal.net>
|
||||
import bs4
|
||||
from bs4 import ( # noqa
|
||||
CData, Comment, Declaration, NavigableString, ProcessingInstruction,
|
||||
SoupStrainer, Tag, __version__
|
||||
)
|
||||
from html5_parser import soup as html5_soup
|
||||
|
||||
from ebook_converter.polyglot.builtins import unicode_type
|
||||
from ebook_converter.ebooks import chardet
|
||||
from ebook_converter.utils import cleantext
|
||||
|
||||
|
||||
def parse_html(markup):
|
||||
from ebook_converter.ebooks.chardet import strip_encoding_declarations, xml_to_unicode, substitute_entites
|
||||
from ebook_converter.utils.cleantext import clean_xml_chars
|
||||
if isinstance(markup, unicode_type):
|
||||
markup = strip_encoding_declarations(markup)
|
||||
markup = substitute_entites(markup)
|
||||
if isinstance(markup, str):
|
||||
markup = chardet.strip_encoding_declarations(markup)
|
||||
markup = chardet.substitute_entites(markup)
|
||||
else:
|
||||
markup = xml_to_unicode(markup, strip_encoding_pats=True, resolve_entities=True)[0]
|
||||
markup = clean_xml_chars(markup)
|
||||
from html5_parser.soup import parse
|
||||
return parse(markup, return_root=False)
|
||||
markup = chardet.xml_to_unicode(markup, strip_encoding_pats=True,
|
||||
resolve_entities=True)[0]
|
||||
markup = cleantext.clean_xml_chars(markup)
|
||||
return html5_soup.parse(markup, return_root=False)
|
||||
|
||||
|
||||
def prettify(soup):
|
||||
@@ -28,9 +24,9 @@ def prettify(soup):
|
||||
return ans
|
||||
|
||||
|
||||
def BeautifulSoup(markup='', *a, **kw):
|
||||
def html5_parser(markup='', *a, **kw):
|
||||
return parse_html(markup)
|
||||
|
||||
|
||||
def BeautifulStoneSoup(markup='', *a, **kw):
|
||||
def beautiful_soup_parser(markup='', *a, **kw):
|
||||
return bs4.BeautifulSoup(markup, 'xml')
|
||||
|
||||
@@ -2,7 +2,6 @@ import io
|
||||
from struct import pack
|
||||
|
||||
from ebook_converter.ebooks.compression import cPalmdoc
|
||||
from ebook_converter.polyglot.builtins import range
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
|
||||
@@ -6,7 +6,7 @@ import shutil, textwrap, codecs, os
|
||||
from ebook_converter.customize.conversion import InputFormatPlugin, OptionRecommendation
|
||||
from ebook_converter import CurrentDir
|
||||
from ebook_converter.ptempfile import PersistentTemporaryDirectory
|
||||
from ebook_converter.polyglot.builtins import getcwd, map
|
||||
from ebook_converter.polyglot.builtins import getcwd
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
|
||||
@@ -4,7 +4,7 @@ from ebook_converter.customize.conversion import (OutputFormatPlugin,
|
||||
OptionRecommendation)
|
||||
from ebook_converter.ptempfile import TemporaryDirectory
|
||||
from ebook_converter import CurrentDir
|
||||
from ebook_converter.polyglot.builtins import unicode_type, filter, map, zip, range, as_bytes
|
||||
from ebook_converter.polyglot.builtins import unicode_type, as_bytes
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
|
||||
@@ -7,7 +7,7 @@ from ebook_converter.customize.conversion import (InputFormatPlugin,
|
||||
from ebook_converter.utils.localization import get_lang
|
||||
from ebook_converter.utils.filenames import ascii_filename
|
||||
from ebook_converter.utils.imghdr import what
|
||||
from ebook_converter.polyglot.builtins import unicode_type, zip, getcwd, as_unicode
|
||||
from ebook_converter.polyglot.builtins import unicode_type, getcwd, as_unicode
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
|
||||
@@ -2,7 +2,7 @@ import os, glob, re, textwrap
|
||||
import pkg_resources
|
||||
|
||||
from ebook_converter.customize.conversion import InputFormatPlugin, OptionRecommendation
|
||||
from ebook_converter.polyglot.builtins import iteritems, filter, getcwd, as_bytes
|
||||
from ebook_converter.polyglot.builtins import iteritems, getcwd, as_bytes
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
@@ -13,7 +13,7 @@ from ebook_converter.utils.zipfile import ZipFile
|
||||
from ebook_converter import (extract, walk, isbytestring, filesystem_encoding,
|
||||
get_types_map)
|
||||
from ebook_converter.constants import __version__
|
||||
from ebook_converter.polyglot.builtins import unicode_type, string_or_bytes, map
|
||||
from ebook_converter.polyglot.builtins import unicode_type, string_or_bytes
|
||||
|
||||
|
||||
__license__ = 'GPL 3'
|
||||
|
||||
@@ -2,7 +2,7 @@ import functools, re, json
|
||||
from math import ceil
|
||||
|
||||
from ebook_converter import entity_to_unicode, as_unicode
|
||||
from ebook_converter.polyglot.builtins import unicode_type, range
|
||||
from ebook_converter.polyglot.builtins import unicode_type
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
|
||||
@@ -2,7 +2,7 @@ import re, random, unicodedata, numbers
|
||||
from collections import namedtuple
|
||||
from contextlib import contextmanager
|
||||
from math import ceil, sqrt, cos, sin, atan2
|
||||
from ebook_converter.polyglot.builtins import iteritems, itervalues, map, zip, string_or_bytes
|
||||
from ebook_converter.polyglot.builtins import iteritems, itervalues, string_or_bytes
|
||||
from itertools import chain
|
||||
|
||||
from PyQt5.Qt import (
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import os
|
||||
from ebook_converter.polyglot.builtins import itervalues, range
|
||||
from ebook_converter.polyglot.builtins import itervalues
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
|
||||
@@ -6,7 +6,7 @@ from ebook_converter.utils.filenames import ascii_filename
|
||||
from ebook_converter.utils.fonts.scanner import font_scanner, NoFonts
|
||||
from ebook_converter.utils.fonts.utils import panose_to_css_generic_family, is_truetype_font
|
||||
from ebook_converter.utils.icu import ord_string
|
||||
from ebook_converter.polyglot.builtins import codepoint_to_chr, iteritems, range
|
||||
from ebook_converter.polyglot.builtins import codepoint_to_chr, iteritems
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
|
||||
@@ -3,7 +3,7 @@ from operator import itemgetter
|
||||
from lxml import etree
|
||||
|
||||
from ebook_converter.utils.icu import partition_by_first_letter, sort_key
|
||||
from ebook_converter.polyglot.builtins import iteritems, filter
|
||||
from ebook_converter.polyglot.builtins import iteritems
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
|
||||
@@ -2,7 +2,7 @@ from lxml.html.builder import TABLE, TR, TD
|
||||
|
||||
from ebook_converter.ebooks.docx.block_styles import inherit, read_shd as rs, read_border, binary_property, border_props, ParagraphStyle, border_to_css
|
||||
from ebook_converter.ebooks.docx.char_styles import RunStyle
|
||||
from ebook_converter.polyglot.builtins import filter, iteritems, itervalues, range, unicode_type
|
||||
from ebook_converter.polyglot.builtins import iteritems, itervalues, unicode_type
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
|
||||
@@ -21,7 +21,7 @@ from ebook_converter.ebooks.docx.fields import Fields
|
||||
from ebook_converter.ebooks.docx.settings import Settings
|
||||
from ebook_converter.ebooks.metadata.opf2 import OPFCreator
|
||||
from ebook_converter.utils.localization import canonicalize_lang, lang_as_iso639_1
|
||||
from ebook_converter.polyglot.builtins import iteritems, itervalues, filter, getcwd, map, unicode_type
|
||||
from ebook_converter.polyglot.builtins import iteritems, itervalues, getcwd, unicode_type
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
|
||||
@@ -5,7 +5,7 @@ from lxml.etree import tostring
|
||||
|
||||
from ebook_converter.ebooks.metadata.toc import TOC
|
||||
from ebook_converter.ebooks.oeb.polish.toc import elem_to_toc_text
|
||||
from ebook_converter.polyglot.builtins import iteritems, range
|
||||
from ebook_converter.polyglot.builtins import iteritems
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
|
||||
@@ -11,7 +11,7 @@ from ebook_converter.ebooks.pdf.render.common import PAPER_SIZES
|
||||
from ebook_converter.utils.date import utcnow
|
||||
from ebook_converter.utils.localization import canonicalize_lang, lang_as_iso639_1
|
||||
from ebook_converter.utils.zipfile import ZipFile
|
||||
from ebook_converter.polyglot.builtins import iteritems, map, unicode_type, native_string_type
|
||||
from ebook_converter.polyglot.builtins import iteritems, unicode_type, native_string_type
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
|
||||
@@ -3,7 +3,6 @@ from uuid import uuid4
|
||||
|
||||
from ebook_converter.ebooks.oeb.base import OEB_STYLES
|
||||
from ebook_converter.ebooks.oeb.transforms.subset import find_font_face_rules
|
||||
from ebook_converter.polyglot.builtins import range
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
|
||||
@@ -2,7 +2,7 @@ import os
|
||||
import posixpath
|
||||
from collections import namedtuple
|
||||
from functools import partial
|
||||
from ebook_converter.polyglot.builtins import iteritems, itervalues, map, unicode_type
|
||||
from ebook_converter.polyglot.builtins import iteritems, itervalues, unicode_type
|
||||
|
||||
from lxml import etree
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ from lxml import etree
|
||||
from ebook_converter.ebooks import parse_css_length
|
||||
from ebook_converter.ebooks.docx.writer.utils import convert_color, int_or_zero
|
||||
from ebook_converter.utils.localization import lang_as_iso639_1
|
||||
from ebook_converter.polyglot.builtins import iteritems, filter, unicode_type
|
||||
from ebook_converter.polyglot.builtins import iteritems, unicode_type
|
||||
from ebook_converter.tinycss.css21 import CSS21Parser
|
||||
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ from collections import namedtuple
|
||||
|
||||
from ebook_converter.ebooks.docx.writer.utils import convert_color
|
||||
from ebook_converter.ebooks.docx.writer.styles import read_css_block_borders as rcbb, border_edges
|
||||
from ebook_converter.polyglot.builtins import iteritems, range, unicode_type
|
||||
from ebook_converter.polyglot.builtins import iteritems, unicode_type
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
|
||||
@@ -12,7 +12,7 @@ from ebook_converter.utils.localization import lang_as_iso639_1
|
||||
from ebook_converter.utils.xml_parse import safe_xml_fromstring
|
||||
from ebook_converter.utils.img import save_cover_data_to
|
||||
from ebook_converter.ebooks.oeb.base import urlnormalize
|
||||
from ebook_converter.polyglot.builtins import unicode_type, string_or_bytes, range, filter
|
||||
from ebook_converter.polyglot.builtins import unicode_type, string_or_bytes
|
||||
from ebook_converter.polyglot.binary import as_base64_unicode
|
||||
from ebook_converter.polyglot.urllib import urlparse
|
||||
|
||||
|
||||
@@ -17,15 +17,15 @@ from functools import partial
|
||||
from itertools import chain
|
||||
from math import ceil, floor
|
||||
|
||||
import bs4
|
||||
|
||||
from ebook_converter import (
|
||||
__appname__, entity_to_unicode, fit_image, force_unicode, preferred_encoding
|
||||
)
|
||||
from ebook_converter.constants import filesystem_encoding
|
||||
from ebook_converter.devices.interface import DevicePlugin as Device
|
||||
from ebook_converter.ebooks import ConversionError
|
||||
from ebook_converter.ebooks.BeautifulSoup import (
|
||||
BeautifulSoup, Comment, Declaration, NavigableString, ProcessingInstruction, Tag
|
||||
)
|
||||
from ebook_converter.ebooks.BeautifulSoup import html5_parser
|
||||
from ebook_converter.ebooks.chardet import xml_to_unicode
|
||||
from ebook_converter.ebooks.lrf import Book
|
||||
from ebook_converter.ebooks.lrf.html.color_map import lrs_color
|
||||
@@ -86,7 +86,7 @@ def tag_regex(tagname):
|
||||
class HTMLConverter(object):
|
||||
SELECTOR_PAT = re.compile(r"([A-Za-z0-9\-\_\:\.]+[A-Za-z0-9\-\_\:\.\s\,]*)\s*\{([^\}]*)\}")
|
||||
PAGE_BREAK_PAT = re.compile(r'page-break-(?:after|before)\s*:\s*(\w+)', re.IGNORECASE)
|
||||
IGNORED_TAGS = (Comment, Declaration, ProcessingInstruction)
|
||||
IGNORED_TAGS = (bs4.Comment, bs4.Declaration, bs4.ProcessingInstruction)
|
||||
|
||||
MARKUP_MASSAGE = [
|
||||
# Close <a /> tags
|
||||
@@ -337,7 +337,7 @@ class HTMLConverter(object):
|
||||
raw = xml_to_unicode(raw, replace_entities=True)[0]
|
||||
for pat, repl in nmassage:
|
||||
raw = pat.sub(repl, raw)
|
||||
soup = BeautifulSoup(raw)
|
||||
soup = html5_parser(raw)
|
||||
if not self.baen and self.is_baen(soup):
|
||||
self.baen = True
|
||||
self.log.info(_('\tBaen file detected. Re-parsing...'))
|
||||
@@ -585,9 +585,9 @@ class HTMLConverter(object):
|
||||
break
|
||||
if isinstance(c, HTMLConverter.IGNORED_TAGS):
|
||||
continue
|
||||
if isinstance(c, NavigableString):
|
||||
if isinstance(c, bs4.NavigableString):
|
||||
text += unicode_type(c)
|
||||
elif isinstance(c, Tag):
|
||||
elif isinstance(c, bs4.Tag):
|
||||
if c.name.lower() == 'img' and c.has_attr('alt'):
|
||||
alt_text += c['alt']
|
||||
continue
|
||||
@@ -720,9 +720,9 @@ class HTMLConverter(object):
|
||||
for c in copy.copy(ptag.contents):
|
||||
if isinstance(c, HTMLConverter.IGNORED_TAGS):
|
||||
continue
|
||||
elif isinstance(c, Tag):
|
||||
elif isinstance(c, bs4.Tag):
|
||||
self.parse_tag(c, pcss)
|
||||
elif isinstance(c, NavigableString):
|
||||
elif isinstance(c, bs4.NavigableString):
|
||||
self.add_text(c, pcss, ppcss)
|
||||
if not self.in_table:
|
||||
try:
|
||||
@@ -1551,11 +1551,11 @@ class HTMLConverter(object):
|
||||
|
||||
if tag.contents:
|
||||
c = tag.contents[0]
|
||||
if isinstance(c, NavigableString):
|
||||
if isinstance(c, bs4.NavigableString):
|
||||
c = unicode_type(c).replace('\r\n', '\n').replace('\r', '\n')
|
||||
if c.startswith('\n'):
|
||||
c = c[1:]
|
||||
tag.contents[0] = NavigableString(c)
|
||||
tag.contents[0] = bs4.NavigableString(c)
|
||||
tag.contents[0].setup(tag)
|
||||
self.process_children(tag, tag_css, tag_pseudo_css)
|
||||
self.end_current_block()
|
||||
@@ -1823,7 +1823,7 @@ def process_file(path, options, logger):
|
||||
for prop in ('author', 'author_sort', 'title', 'title_sort', 'publisher', 'freetext'):
|
||||
val = getattr(options, prop, None)
|
||||
if val and not isinstance(val, unicode_type):
|
||||
soup = BeautifulSoup(val)
|
||||
soup = html5_parser(val)
|
||||
setattr(options, prop, unicode_type(soup))
|
||||
|
||||
title = (options.title, options.title_sort)
|
||||
|
||||
@@ -4,7 +4,7 @@ from ebook_converter.ebooks.lrf.fonts import get_font
|
||||
from ebook_converter.ebooks.lrf.pylrs.pylrs import TextBlock, Text, CR, Span, \
|
||||
CharButton, Plot, Paragraph, \
|
||||
LrsTextTag
|
||||
from ebook_converter.polyglot.builtins import string_or_bytes, range, native_string_type
|
||||
from ebook_converter.polyglot.builtins import string_or_bytes, native_string_type
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
|
||||
@@ -6,7 +6,7 @@ import os, sys, re
|
||||
|
||||
from ebook_converter import relpath, guess_type, prints, force_unicode
|
||||
from ebook_converter.utils.config_base import tweaks
|
||||
from ebook_converter.polyglot.builtins import codepoint_to_chr, unicode_type, range, map, zip, getcwd, iteritems, itervalues, as_unicode
|
||||
from ebook_converter.polyglot.builtins import codepoint_to_chr, unicode_type, getcwd, iteritems, itervalues, as_unicode
|
||||
from ebook_converter.polyglot.urllib import quote, unquote, urlparse
|
||||
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ from contextlib import closing
|
||||
|
||||
from ebook_converter.customize import FileTypePlugin
|
||||
from ebook_converter.utils.localization import canonicalize_lang
|
||||
from ebook_converter.polyglot.builtins import filter, unicode_type
|
||||
from ebook_converter.polyglot.builtins import unicode_type
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
|
||||
@@ -7,7 +7,7 @@ from ebook_converter.ebooks.metadata.book import (SC_COPYABLE_FIELDS,
|
||||
TOP_LEVEL_IDENTIFIERS, ALL_METADATA_FIELDS)
|
||||
from ebook_converter.library.field_metadata import FieldMetadata
|
||||
from ebook_converter.utils.icu import sort_key
|
||||
from ebook_converter.polyglot.builtins import iteritems, unicode_type, filter, map
|
||||
from ebook_converter.polyglot.builtins import iteritems, unicode_type
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
|
||||
@@ -17,7 +17,7 @@ from ebook_converter import prints, guess_type
|
||||
from ebook_converter.utils.cleantext import clean_ascii_chars, clean_xml_chars
|
||||
from ebook_converter.utils.config import tweaks
|
||||
from ebook_converter.utils.xml_parse import safe_xml_fromstring
|
||||
from ebook_converter.polyglot.builtins import iteritems, unicode_type, getcwd, map
|
||||
from ebook_converter.polyglot.builtins import iteritems, unicode_type, getcwd
|
||||
from ebook_converter.polyglot.urllib import unquote, urlparse
|
||||
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import json
|
||||
import re
|
||||
from collections import defaultdict, namedtuple
|
||||
from functools import wraps
|
||||
from ebook_converter.polyglot.builtins import iteritems, map, filter
|
||||
from ebook_converter.polyglot.builtins import iteritems
|
||||
|
||||
from lxml import etree
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import re
|
||||
|
||||
from ebook_converter import force_unicode
|
||||
from ebook_converter.ebooks.metadata import MetaInformation
|
||||
from ebook_converter.polyglot.builtins import codepoint_to_chr, string_or_bytes, unicode_type, int_to_byte, filter
|
||||
from ebook_converter.polyglot.builtins import codepoint_to_chr, string_or_bytes, unicode_type, int_to_byte
|
||||
|
||||
title_pat = re.compile(br'\{\\info.*?\{\\title(.*?)(?<!\\)\}', re.DOTALL)
|
||||
author_pat = re.compile(br'\{\\info.*?\{\\author(.*?)(?<!\\)\}', re.DOTALL)
|
||||
|
||||
@@ -7,7 +7,6 @@ from ebook_converter.spell import parse_lang_code
|
||||
from ebook_converter.utils.cleantext import clean_xml_chars
|
||||
from ebook_converter.utils.localization import lang_as_iso639_1
|
||||
from ebook_converter.utils.xml_parse import safe_xml_fromstring
|
||||
from ebook_converter.polyglot.builtins import filter, map
|
||||
|
||||
|
||||
OPFVersion = namedtuple('OPFVersion', 'major minor patch')
|
||||
|
||||
@@ -12,7 +12,7 @@ from ebook_converter.ebooks.metadata.book.base import Metadata
|
||||
from ebook_converter.ebooks.metadata.opf2 import dump_dict
|
||||
from ebook_converter.utils.date import parse_date, isoformat, now
|
||||
from ebook_converter.utils.localization import canonicalize_lang, lang_as_iso639_1
|
||||
from ebook_converter.polyglot.builtins import iteritems, string_or_bytes, filter
|
||||
from ebook_converter.polyglot.builtins import iteritems, string_or_bytes
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
|
||||
@@ -5,7 +5,6 @@ darkninja and igorsk.
|
||||
import struct
|
||||
|
||||
from ebook_converter.ebooks.mobi import MobiError
|
||||
from ebook_converter.polyglot.builtins import map
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
|
||||
@@ -3,7 +3,7 @@ from collections import OrderedDict, namedtuple
|
||||
|
||||
from ebook_converter.ebooks.mobi.utils import (decint, count_set_bits,
|
||||
decode_string)
|
||||
from ebook_converter.polyglot.builtins import iteritems, range, zip
|
||||
from ebook_converter.polyglot.builtins import iteritems
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import re, os
|
||||
|
||||
from ebook_converter.ebooks.chardet import strip_encoding_declarations
|
||||
from ebook_converter.polyglot.builtins import unicode_type, range
|
||||
from ebook_converter.polyglot.builtins import unicode_type
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
|
||||
@@ -16,7 +16,7 @@ from ebook_converter.ebooks.metadata.toc import TOC
|
||||
from ebook_converter.ebooks.mobi.reader.headers import BookHeader
|
||||
from ebook_converter.utils.img import save_cover_data_to, gif_data_to_png_data, AnimatedGIF
|
||||
from ebook_converter.utils.imghdr import what
|
||||
from ebook_converter.polyglot.builtins import iteritems, unicode_type, range, map
|
||||
from ebook_converter.polyglot.builtins import iteritems, unicode_type
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
|
||||
@@ -15,7 +15,7 @@ from ebook_converter.ebooks.metadata.toc import TOC
|
||||
from ebook_converter.ebooks.mobi.utils import read_font_record
|
||||
from ebook_converter.ebooks.oeb.parse_utils import parse_html
|
||||
from ebook_converter.ebooks.oeb.base import XPath, XHTML, xml2text
|
||||
from ebook_converter.polyglot.builtins import range, zip, unicode_type, getcwd, as_unicode
|
||||
from ebook_converter.polyglot.builtins import unicode_type, getcwd, as_unicode
|
||||
from ebook_converter.polyglot.urllib import urldefrag
|
||||
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ from io import BytesIO
|
||||
from ebook_converter.utils.img import save_cover_data_to, scale_image, image_to_data, image_from_data, resize_image, png_data_to_gif_data
|
||||
from ebook_converter.utils.imghdr import what
|
||||
from ebook_converter.ebooks import normalize
|
||||
from ebook_converter.polyglot.builtins import unicode_type, range, as_bytes, map
|
||||
from ebook_converter.polyglot.builtins import unicode_type, as_bytes
|
||||
from ebook_converter.tinycss.color3 import parse_color_string
|
||||
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ from collections import OrderedDict, defaultdict
|
||||
|
||||
from ebook_converter.ebooks.mobi.utils import (encint, encode_number_as_hex,
|
||||
encode_tbs, align_block, RECORD_SIZE, CNCX as CNCX_)
|
||||
from ebook_converter.polyglot.builtins import filter, iteritems, itervalues, map, range
|
||||
from ebook_converter.polyglot.builtins import iteritems, itervalues
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
|
||||
@@ -10,7 +10,7 @@ from ebook_converter.ebooks.mobi.writer2 import (PALMDOC, UNCOMPRESSED)
|
||||
from ebook_converter.ebooks.mobi.utils import (encint, encode_trailing_data,
|
||||
align_block, detect_periodical, RECORD_SIZE, create_text_record)
|
||||
from ebook_converter.ebooks.mobi.writer2.indexer import Indexer
|
||||
from ebook_converter.polyglot.builtins import iteritems, unicode_type, range
|
||||
from ebook_converter.polyglot.builtins import iteritems, unicode_type
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
|
||||
@@ -15,7 +15,7 @@ from odf.namespaces import TEXTNS as odTEXTNS
|
||||
from ebook_converter import CurrentDir, walk
|
||||
from ebook_converter.ebooks.oeb.base import _css_logger
|
||||
from ebook_converter.utils.xml_parse import safe_xml_fromstring
|
||||
from ebook_converter.polyglot.builtins import unicode_type, string_or_bytes, filter, getcwd, as_bytes
|
||||
from ebook_converter.polyglot.builtins import unicode_type, string_or_bytes, getcwd, as_bytes
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
|
||||
@@ -16,7 +16,7 @@ from ebook_converter import (isbytestring, as_unicode, get_types_map)
|
||||
from ebook_converter.ebooks.oeb.parse_utils import barename, XHTML_NS, namespace, XHTML, parse_html, NotHTML
|
||||
from ebook_converter.utils.cleantext import clean_xml_chars
|
||||
from ebook_converter.utils.short_uuid import uuid4
|
||||
from ebook_converter.polyglot.builtins import iteritems, unicode_type, string_or_bytes, range, itervalues, filter, codepoint_to_chr
|
||||
from ebook_converter.polyglot.builtins import iteritems, unicode_type, string_or_bytes, itervalues, codepoint_to_chr
|
||||
from ebook_converter.polyglot.urllib import unquote as urlunquote, urldefrag, urljoin, urlparse, urlunparse
|
||||
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ from css_parser.css import PropertyValue
|
||||
from css_parser import profile as cssprofiles, CSSParser
|
||||
from ebook_converter.tinycss.fonts3 import parse_font, serialize_font_family
|
||||
from ebook_converter.ebooks.oeb.base import css_text
|
||||
from ebook_converter.polyglot.builtins import iteritems, string_or_bytes, unicode_type, zip
|
||||
from ebook_converter.polyglot.builtins import iteritems, string_or_bytes, unicode_type
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
|
||||
@@ -6,7 +6,7 @@ from ebook_converter import xml_replace_entities, force_unicode
|
||||
from ebook_converter.utils.xml_parse import safe_xml_fromstring
|
||||
from ebook_converter.constants import filesystem_encoding
|
||||
from ebook_converter.ebooks.chardet import xml_to_unicode, strip_encoding_declarations
|
||||
from ebook_converter.polyglot.builtins import iteritems, itervalues, unicode_type, string_or_bytes, map
|
||||
from ebook_converter.polyglot.builtins import iteritems, itervalues, unicode_type, string_or_bytes
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
|
||||
@@ -48,7 +48,7 @@ from ebook_converter.utils.ipc.simple_worker import WorkerError, fork_job
|
||||
from ebook_converter.utils.logging import default_log
|
||||
from ebook_converter.utils.xml_parse import safe_xml_fromstring
|
||||
from ebook_converter.utils.zipfile import ZipFile
|
||||
from ebook_converter.polyglot.builtins import iteritems, map, unicode_type, zip
|
||||
from ebook_converter.polyglot.builtins import iteritems, unicode_type
|
||||
from ebook_converter.polyglot.urllib import urlparse
|
||||
|
||||
exists, join, relpath = os.path.exists, os.path.join, os.path.relpath
|
||||
|
||||
@@ -10,7 +10,7 @@ from ebook_converter.ebooks.oeb.normalize_css import normalize_filter_css, norma
|
||||
from ebook_converter.ebooks.oeb.polish.pretty import pretty_script_or_style, pretty_xml_tree, serialize
|
||||
from ebook_converter.utils.icu import numeric_sort_key
|
||||
from ebook_converter.css_selectors import Select, SelectorError
|
||||
from ebook_converter.polyglot.builtins import iteritems, itervalues, unicode_type, filter
|
||||
from ebook_converter.polyglot.builtins import iteritems, itervalues, unicode_type
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import textwrap
|
||||
from ebook_converter.polyglot.builtins import iteritems, map
|
||||
from ebook_converter.polyglot.builtins import iteritems
|
||||
|
||||
# from lxml.etree import Element
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import codecs, shutil, os, posixpath
|
||||
from ebook_converter.polyglot.builtins import iteritems, itervalues, map
|
||||
from ebook_converter.polyglot.builtins import iteritems, itervalues
|
||||
from functools import partial
|
||||
from collections import Counter, defaultdict
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import copy, os, re
|
||||
from ebook_converter.polyglot.builtins import map, string_or_bytes, range
|
||||
from ebook_converter.polyglot.builtins import string_or_bytes
|
||||
|
||||
from ebook_converter.ebooks.oeb.base import barename, XPNSMAP, XPath, OPF, XHTML, OEB_DOCS
|
||||
from ebook_converter.ebooks.oeb.polish.errors import MalformedMarkup
|
||||
|
||||
@@ -15,7 +15,7 @@ from ebook_converter.ebooks.oeb.polish.utils import guess_type, extract
|
||||
from ebook_converter.ebooks.oeb.polish.opf import set_guide_item, get_book_language
|
||||
from ebook_converter.ebooks.oeb.polish.pretty import pretty_html_tree
|
||||
from ebook_converter.utils.localization import get_lang, canonicalize_lang, lang_as_iso639_1
|
||||
from ebook_converter.polyglot.builtins import iteritems, map, unicode_type
|
||||
from ebook_converter.polyglot.builtins import iteritems, unicode_type
|
||||
from ebook_converter.polyglot.urllib import urlparse
|
||||
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ import re, os
|
||||
from bisect import bisect
|
||||
|
||||
from ebook_converter import guess_type as _guess_type, replace_entities
|
||||
from ebook_converter.polyglot.builtins import filter
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
|
||||
@@ -22,7 +22,7 @@ from ebook_converter.utils.localization import get_lang
|
||||
from ebook_converter.ptempfile import TemporaryDirectory
|
||||
from ebook_converter.constants import __appname__, __version__
|
||||
from ebook_converter import guess_type, xml_replace_entities
|
||||
from ebook_converter.polyglot.builtins import unicode_type, zip
|
||||
from ebook_converter.polyglot.builtins import unicode_type
|
||||
from ebook_converter.polyglot.urllib import unquote, urldefrag, urlparse
|
||||
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ from ebook_converter.ebooks import unit_convert
|
||||
from ebook_converter.ebooks.oeb.base import XHTML, XHTML_NS, CSS_MIME, OEB_STYLES, xpath, urlnormalize
|
||||
from ebook_converter.ebooks.oeb.normalize_css import DEFAULTS, normalizers
|
||||
from ebook_converter.css_selectors import Select, SelectorError, INAPPROPRIATE_PSEUDO_CLASSES
|
||||
from ebook_converter.polyglot.builtins import iteritems, unicode_type, filter
|
||||
from ebook_converter.polyglot.builtins import iteritems, unicode_type
|
||||
from ebook_converter.tinycss.media3 import CSSMedia3Parser
|
||||
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ from ebook_converter.ebooks.oeb.base import (XHTML, XHTML_NS, CSS_MIME, OEB_STYL
|
||||
from ebook_converter.ebooks.oeb.stylizer import Stylizer
|
||||
from ebook_converter.utils.filenames import ascii_filename, ascii_text
|
||||
from ebook_converter.utils.icu import numeric_sort_key
|
||||
from ebook_converter.polyglot.builtins import iteritems, unicode_type, string_or_bytes, map
|
||||
from ebook_converter.polyglot.builtins import iteritems, unicode_type, string_or_bytes
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
|
||||
@@ -10,7 +10,7 @@ from ebook_converter.library.comments import comments_to_html, markdown
|
||||
from ebook_converter.utils.date import is_date_undefined, as_local_time
|
||||
from ebook_converter.ebooks.chardet import strip_encoding_declarations
|
||||
from ebook_converter.ebooks.metadata import fmt_sidx, rating_to_stars
|
||||
from ebook_converter.polyglot.builtins import unicode_type, map
|
||||
from ebook_converter.polyglot.builtins import unicode_type
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
|
||||
@@ -14,7 +14,7 @@ from ebook_converter.ebooks.epub import rules
|
||||
from ebook_converter.ebooks.oeb.base import (OEB_STYLES, XPNSMAP as NAMESPACES,
|
||||
urldefrag, rewrite_links, XHTML, urlnormalize)
|
||||
from ebook_converter.ebooks.oeb.polish.split import do_split
|
||||
from ebook_converter.polyglot.builtins import iteritems, range, map, unicode_type
|
||||
from ebook_converter.polyglot.builtins import iteritems, unicode_type
|
||||
from ebook_converter.polyglot.urllib import unquote
|
||||
from ebook_converter.css_selectors import Select, SelectorError
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ from collections import defaultdict
|
||||
|
||||
from ebook_converter.ebooks.oeb.base import urlnormalize, css_text
|
||||
from ebook_converter.utils.fonts.sfnt.subset import subset, NoGlyphs, UnsupportedFont
|
||||
from ebook_converter.polyglot.builtins import iteritems, itervalues, unicode_type, range
|
||||
from ebook_converter.polyglot.builtins import iteritems, itervalues, unicode_type
|
||||
from ebook_converter.tinycss.fonts3 import parse_font_family
|
||||
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ from ebook_converter.ebooks import DRMError
|
||||
from ebook_converter.ebooks.metadata.opf2 import OPFCreator
|
||||
from ebook_converter.ebooks.pdb.ereader import EreaderError
|
||||
from ebook_converter.ebooks.pdb.formatreader import FormatReader
|
||||
from ebook_converter.polyglot.builtins import unicode_type, range
|
||||
from ebook_converter.polyglot.builtins import unicode_type
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
|
||||
@@ -9,7 +9,7 @@ from ebook_converter import CurrentDir
|
||||
from ebook_converter.ebooks.metadata.opf2 import OPFCreator
|
||||
from ebook_converter.ebooks.pdb.formatreader import FormatReader
|
||||
from ebook_converter.ebooks.pdb.ereader import EreaderError
|
||||
from ebook_converter.polyglot.builtins import unicode_type, range
|
||||
from ebook_converter.polyglot.builtins import unicode_type
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
|
||||
@@ -8,7 +8,6 @@ from ebook_converter import prepare_string_for_xml
|
||||
from ebook_converter.ebooks.pdb.formatreader import FormatReader
|
||||
from ebook_converter.ebooks.metadata import MetaInformation
|
||||
from ebook_converter.ebooks.txt.processor import opf_writer, HTML_TEMPLATE
|
||||
from ebook_converter.polyglot.builtins import range, map
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
|
||||
@@ -3,7 +3,6 @@ Read content from palmdoc pdb file.
|
||||
"""
|
||||
from ebook_converter.ebooks.pdb.formatreader import FormatReader
|
||||
from ebook_converter.ptempfile import PersistentTemporaryFile
|
||||
from ebook_converter.polyglot.builtins import range
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
|
||||
@@ -9,7 +9,7 @@ from ebook_converter.ebooks.pdb.formatreader import FormatReader
|
||||
from ebook_converter.ebooks.compression.palmdoc import decompress_doc
|
||||
from ebook_converter.utils.imghdr import identify
|
||||
from ebook_converter.utils.img import save_cover_data_to, Canvas, image_from_data
|
||||
from ebook_converter.polyglot.builtins import codepoint_to_chr, range
|
||||
from ebook_converter.polyglot.builtins import codepoint_to_chr
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
|
||||
@@ -15,7 +15,7 @@ import os, re
|
||||
from ebook_converter.ebooks.rtf2xml import copy
|
||||
from ebook_converter.utils.mreplace import MReplace
|
||||
from ebook_converter.ptempfile import better_mktemp
|
||||
from ebook_converter.polyglot.builtins import codepoint_to_chr, range, filter, map
|
||||
from ebook_converter.polyglot.builtins import codepoint_to_chr
|
||||
from . import open_for_read, open_for_write
|
||||
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ from ebook_converter.ebooks.metadata.opf2 import OPFCreator
|
||||
|
||||
from ebook_converter.ebooks.conversion.preprocess import DocAnalysis
|
||||
from ebook_converter.utils.cleantext import clean_ascii_chars
|
||||
from ebook_converter.polyglot.builtins import iteritems, unicode_type, map, range, long_type
|
||||
from ebook_converter.polyglot.builtins import iteritems, unicode_type, long_type
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
|
||||
Reference in New Issue
Block a user