1
0
mirror of https://github.com/gryf/ebook-converter.git synced 2026-04-20 13:11:27 +02:00

Removing couple of "buildins" polyglot types

This commit is contained in:
2020-04-20 20:22:50 +02:00
parent eac0b98d6f
commit c867f0321b
36 changed files with 85 additions and 109 deletions
@@ -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, string_or_bytes
from ebook_converter.polyglot.builtins import iteritems
__license__ = 'GPL v3'
@@ -351,7 +351,7 @@ class CSSFlattener(object):
cssdict[property] = "%0.5fem" % (value / fsize)
def flatten_node(self, node, stylizer, names, styles, pseudo_styles, psize, item_id, recurse=True):
if not isinstance(node.tag, string_or_bytes) \
if not isinstance(node.tag, (str, bytes)) \
or namespace(node.tag) != XHTML_NS:
return
tag = barename(node.tag)
@@ -6,7 +6,6 @@ from ebook_converter.ebooks.oeb.base import XHTML, XHTML_NS
from ebook_converter.ebooks.oeb.base import CSS_MIME
from ebook_converter.ebooks.oeb.base import namespace
from ebook_converter.ebooks.oeb.stylizer import Stylizer
from ebook_converter.polyglot.builtins import string_or_bytes
__license__ = 'GPL v3'
@@ -95,7 +94,7 @@ class CaseMangler(object):
last = child
def mangle_elem(self, elem, stylizer):
if not isinstance(elem.tag, string_or_bytes) or \
if not isinstance(elem.tag, (str, bytes)) or \
namespace(elem.tag) != XHTML_NS:
return
children = list(elem)