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

Removed polyglots unicode_type usage

This commit is contained in:
2020-04-20 19:25:28 +02:00
parent ef7e2b10be
commit 128705f258
130 changed files with 657 additions and 716 deletions
+4 -4
View File
@@ -1,7 +1,7 @@
"""
elements.py -- replacements and helpers for ElementTree
"""
from ebook_converter.polyglot.builtins import unicode_type, string_or_bytes
from ebook_converter.polyglot.builtins import string_or_bytes
class ElementWriter(object):
@@ -24,9 +24,9 @@ class ElementWriter(object):
return text
def _writeAttribute(self, f, name, value):
f.write(' %s="' % unicode_type(name))
f.write(' %s="' % str(name))
if not isinstance(value, string_or_bytes):
value = unicode_type(value)
value = str(value)
value = self._encodeCdata(value)
value = value.replace('"', '"')
f.write(value)
@@ -37,7 +37,7 @@ class ElementWriter(object):
f.write(text)
def _write(self, f, e):
f.write('<' + unicode_type(e.tag))
f.write('<' + str(e.tag))
attributes = e.items()
attributes.sort()