diff --git a/src/calibre/ebooks/conversion/__init__.py b/src/calibre/ebooks/conversion/__init__.py index 675e233317..a8eb882a97 100644 --- a/src/calibre/ebooks/conversion/__init__.py +++ b/src/calibre/ebooks/conversion/__init__.py @@ -22,4 +22,4 @@ class ConversionUserFeedBack(Exception): # Ensure exception uses fully qualified name as this is used to detect it in # the GUI. -ConversionUserFeedBack.__name__ = str('calibre.ebooks.conversion.ConversionUserFeedBack') +ConversionUserFeedBack.__name__ = 'calibre.ebooks.conversion.ConversionUserFeedBack' diff --git a/src/calibre/ebooks/docx/writer/container.py b/src/calibre/ebooks/docx/writer/container.py index f747697689..b729ef73dc 100644 --- a/src/calibre/ebooks/docx/writer/container.py +++ b/src/calibre/ebooks/docx/writer/container.py @@ -243,7 +243,7 @@ class DOCX: namespaces = self.namespace.namespaces E = ElementMaker(namespace=namespaces['cp'], nsmap={x:namespaces[x] for x in 'cp dc dcterms xsi'.split()}) cp = E.coreProperties(E.revision('1'), E.lastModifiedBy('calibre')) - ts = utcnow().isoformat(str('T')).rpartition('.')[0] + 'Z' + ts = utcnow().isoformat('T').rpartition('.')[0] + 'Z' for x in 'created modified'.split(): x = cp.makeelement('{{{}}}{}'.format(namespaces['dcterms'], x), **{'{{{}}}type'.format(namespaces['xsi']):'dcterms:W3CDTF'}) x.text = ts diff --git a/src/calibre/ebooks/lrf/html/table.py b/src/calibre/ebooks/lrf/html/table.py index a0d40999d3..82f65201fb 100644 --- a/src/calibre/ebooks/lrf/html/table.py +++ b/src/calibre/ebooks/lrf/html/table.py @@ -15,8 +15,8 @@ def ceil(num): def print_xml(elem): from calibre.ebooks.lrf.pylrs.pylrs import ElementWriter - elem = elem.toElement(str('utf8')) - ew = ElementWriter(elem, sourceEncoding=str('utf8')) + elem = elem.toElement('utf8') + ew = ElementWriter(elem, sourceEncoding='utf8') ew.write(sys.stdout) print() diff --git a/src/calibre/ebooks/lrf/pylrs/pylrs.py b/src/calibre/ebooks/lrf/pylrs/pylrs.py index 6cfe89d6e3..67c9a416bc 100644 --- a/src/calibre/ebooks/lrf/pylrs/pylrs.py +++ b/src/calibre/ebooks/lrf/pylrs/pylrs.py @@ -674,7 +674,7 @@ class Info(Delegator): # NB: generates an encoding attribute, which lrs2lrf does not tree = ElementTree(element=info) f = io.BytesIO() - tree.write(f, encoding=str('utf-8'), xml_declaration=True) + tree.write(f, encoding='utf-8', xml_declaration=True) xmlInfo = f.getvalue().decode('utf-8') xmlInfo = re.sub(r'\n', '', xmlInfo) xmlInfo = xmlInfo.replace('SumPage>', 'Page>') diff --git a/src/calibre/gui2/tweak_book/editor/syntax/javascript.py b/src/calibre/gui2/tweak_book/editor/syntax/javascript.py index e63b78cdb7..48ae4109f6 100644 --- a/src/calibre/gui2/tweak_book/editor/syntax/javascript.py +++ b/src/calibre/gui2/tweak_book/editor/syntax/javascript.py @@ -31,39 +31,39 @@ class JavascriptLexer(RegexLexer): flags = re.UNICODE | re.MULTILINE tokens = { - str('commentsandwhitespace'): [ + 'commentsandwhitespace': [ (r'\s+', Text), (r'