mirror of
https://github.com/gryf/ebook-converter.git
synced 2026-04-26 16:41:29 +02:00
Removed polyglots unicode_type usage
This commit is contained in:
@@ -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
|
||||
from ebook_converter.polyglot.builtins import iteritems
|
||||
from ebook_converter.tinycss.media3 import CSSMedia3Parser
|
||||
|
||||
|
||||
@@ -317,7 +317,7 @@ class Stylizer(object):
|
||||
for x in elem.iter('*'):
|
||||
if x.text:
|
||||
punctuation_chars = []
|
||||
text = unicode_type(x.text)
|
||||
text = str(x.text)
|
||||
while text:
|
||||
category = unicodedata.category(text[0])
|
||||
if category[0] not in {'P', 'Z'}:
|
||||
@@ -591,7 +591,7 @@ class Style(object):
|
||||
x = self._style.get(attr)
|
||||
if x is not None:
|
||||
if x == 'auto':
|
||||
ans = self._unit_convert(unicode_type(img_size) + 'px', base=base)
|
||||
ans = self._unit_convert(str(img_size) + 'px', base=base)
|
||||
else:
|
||||
x = self._unit_convert(x, base=base)
|
||||
if isinstance(x, numbers.Number):
|
||||
@@ -603,7 +603,7 @@ class Style(object):
|
||||
if isinstance(x, numbers.Number):
|
||||
ans = x
|
||||
if ans is None:
|
||||
ans = self._unit_convert(unicode_type(img_size) + 'px', base=base)
|
||||
ans = self._unit_convert(str(img_size) + 'px', base=base)
|
||||
maa = self._style.get('max-' + attr)
|
||||
if maa is not None:
|
||||
x = self._unit_convert(maa, base=base)
|
||||
@@ -639,12 +639,12 @@ class Style(object):
|
||||
result = base
|
||||
else:
|
||||
result = self._unit_convert(width, base=base)
|
||||
if isinstance(result, (unicode_type, bytes)):
|
||||
if isinstance(result, (str, bytes)):
|
||||
result = self._profile.width
|
||||
self._width = result
|
||||
if 'max-width' in self._style:
|
||||
result = self._unit_convert(self._style['max-width'], base=base)
|
||||
if isinstance(result, (unicode_type, bytes)):
|
||||
if isinstance(result, (str, bytes)):
|
||||
result = self._width
|
||||
if result < self._width:
|
||||
self._width = result
|
||||
@@ -676,12 +676,12 @@ class Style(object):
|
||||
result = base
|
||||
else:
|
||||
result = self._unit_convert(height, base=base)
|
||||
if isinstance(result, (unicode_type, bytes)):
|
||||
if isinstance(result, (str, bytes)):
|
||||
result = self._profile.height
|
||||
self._height = result
|
||||
if 'max-height' in self._style:
|
||||
result = self._unit_convert(self._style['max-height'], base=base)
|
||||
if isinstance(result, (unicode_type, bytes)):
|
||||
if isinstance(result, (str, bytes)):
|
||||
result = self._height
|
||||
if result < self._height:
|
||||
self._height = result
|
||||
|
||||
Reference in New Issue
Block a user