mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
IGN:Set default cssutils log level to WARN and remove various unused imports from ebooks.oeb
This commit is contained in:
parent
d19d687dec
commit
78cadc9c3a
@ -27,7 +27,8 @@ mimetypes.add_type('application/adobe-page-template+xml', '.xpgt')
|
|||||||
mimetypes.add_type('application/x-font-opentype', '.otf')
|
mimetypes.add_type('application/x-font-opentype', '.otf')
|
||||||
mimetypes.add_type('application/x-font-truetype', '.ttf')
|
mimetypes.add_type('application/x-font-truetype', '.ttf')
|
||||||
mimetypes.add_type('application/oebps-package+xml', '.opf')
|
mimetypes.add_type('application/oebps-package+xml', '.opf')
|
||||||
|
import cssutils
|
||||||
|
cssutils.log.setLevel(logging.WARN)
|
||||||
|
|
||||||
def to_unicode(raw, encoding='utf-8', errors='strict'):
|
def to_unicode(raw, encoding='utf-8', errors='strict'):
|
||||||
if isinstance(raw, unicode):
|
if isinstance(raw, unicode):
|
||||||
|
@ -8,15 +8,10 @@ from __future__ import with_statement
|
|||||||
__license__ = 'GPL v3'
|
__license__ = 'GPL v3'
|
||||||
__copyright__ = '2008, Marshall T. Vandegrift <llasram@gmail.com>'
|
__copyright__ = '2008, Marshall T. Vandegrift <llasram@gmail.com>'
|
||||||
|
|
||||||
import sys
|
|
||||||
import os
|
import os
|
||||||
import locale
|
|
||||||
import codecs
|
|
||||||
import itertools
|
import itertools
|
||||||
import types
|
|
||||||
import re
|
import re
|
||||||
import copy
|
import copy
|
||||||
from itertools import izip
|
|
||||||
from weakref import WeakKeyDictionary
|
from weakref import WeakKeyDictionary
|
||||||
from xml.dom import SyntaxErr as CSSSyntaxError
|
from xml.dom import SyntaxErr as CSSSyntaxError
|
||||||
import cssutils
|
import cssutils
|
||||||
@ -25,7 +20,7 @@ from cssutils.css import CSSStyleRule, CSSPageRule, CSSStyleDeclaration, \
|
|||||||
from lxml import etree
|
from lxml import etree
|
||||||
from lxml.cssselect import css_to_xpath, ExpressionError
|
from lxml.cssselect import css_to_xpath, ExpressionError
|
||||||
from calibre.ebooks.oeb.base import XHTML, XHTML_NS, CSS_MIME, OEB_STYLES
|
from calibre.ebooks.oeb.base import XHTML, XHTML_NS, CSS_MIME, OEB_STYLES
|
||||||
from calibre.ebooks.oeb.base import XPNSMAP, xpath, barename, urlnormalize
|
from calibre.ebooks.oeb.base import XPNSMAP, xpath, urlnormalize
|
||||||
from calibre.ebooks.oeb.profile import PROFILES
|
from calibre.ebooks.oeb.profile import PROFILES
|
||||||
from calibre.resources import html_css
|
from calibre.resources import html_css
|
||||||
|
|
||||||
@ -163,7 +158,7 @@ class Stylizer(object):
|
|||||||
for _, _, cssdict, text, _ in rules:
|
for _, _, cssdict, text, _ in rules:
|
||||||
try:
|
try:
|
||||||
selector = CSSSelector(text)
|
selector = CSSSelector(text)
|
||||||
except ExpressionError, e:
|
except ExpressionError:
|
||||||
continue
|
continue
|
||||||
for elem in selector(tree):
|
for elem in selector(tree):
|
||||||
self.style(elem)._update_cssdict(cssdict)
|
self.style(elem)._update_cssdict(cssdict)
|
||||||
|
@ -6,13 +6,9 @@ from __future__ import with_statement
|
|||||||
__license__ = 'GPL v3'
|
__license__ = 'GPL v3'
|
||||||
__copyright__ = '2008, Marshall T. Vandegrift <llasram@gmail.com>'
|
__copyright__ = '2008, Marshall T. Vandegrift <llasram@gmail.com>'
|
||||||
|
|
||||||
import sys
|
|
||||||
import os
|
|
||||||
from itertools import chain
|
from itertools import chain
|
||||||
from urlparse import urldefrag
|
from urlparse import urldefrag
|
||||||
from lxml import etree
|
from calibre.ebooks.oeb.base import CSS_MIME, OEB_DOCS
|
||||||
import cssutils
|
|
||||||
from calibre.ebooks.oeb.base import XPNSMAP, CSS_MIME, OEB_DOCS
|
|
||||||
from calibre.ebooks.oeb.base import LINK_SELECTORS, CSSURL_RE
|
from calibre.ebooks.oeb.base import LINK_SELECTORS, CSSURL_RE
|
||||||
from calibre.ebooks.oeb.base import urlnormalize
|
from calibre.ebooks.oeb.base import urlnormalize
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user