mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
upgrade code to Python 3 (auto-fix)
ruff 'UP'
This commit is contained in:
parent
b5aca6ff5c
commit
5572105076
@ -1,5 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
# vim:fileencoding=utf-8
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
|
@ -1,5 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
# vim:fileencoding=utf-8
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
|
@ -1,5 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
# vim:fileencoding=utf-8
|
||||
# License: GPLv3 Copyright: 2016, Kovid Goyal <kovid at kovidgoyal.net>
|
||||
|
||||
import argparse
|
||||
|
@ -1,5 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
# vim:fileencoding=utf-8
|
||||
# License: GPLv3 Copyright: 2016, Kovid Goyal <kovid at kovidgoyal.net>
|
||||
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
# vim:fileencoding=utf-8
|
||||
# License: GPLv3 Copyright: 2016, Kovid Goyal <kovid at kovidgoyal.net>
|
||||
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
# vim:fileencoding=utf-8
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
|
@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# calibre documentation build configuration file, created by
|
||||
# sphinx-quickstart.py on Sun Mar 23 01:23:55 2008.
|
||||
@ -64,7 +63,7 @@ language = os.environ.get('CALIBRE_OVERRIDE_LANG', 'en')
|
||||
def generated_langs():
|
||||
try:
|
||||
return os.listdir(os.path.join(base, 'generated'))
|
||||
except EnvironmentError as e:
|
||||
except OSError as e:
|
||||
if e.errno != errno.ENOENT:
|
||||
raise
|
||||
return ()
|
||||
@ -105,7 +104,7 @@ if needs_localization:
|
||||
import gettext
|
||||
try:
|
||||
t = gettext.translation('simple_index', locale_dirs[0], [language])
|
||||
except IOError:
|
||||
except OSError:
|
||||
pass
|
||||
else:
|
||||
title = t.gettext(title)
|
||||
@ -176,7 +175,7 @@ def sort_languages(x):
|
||||
lc, name = x
|
||||
if lc == language:
|
||||
return ''
|
||||
return sort_key(type(u'')(name))
|
||||
return sort_key(str(name))
|
||||
|
||||
|
||||
website = 'https://calibre-ebook.com'
|
||||
@ -193,13 +192,13 @@ extlinks = {
|
||||
}
|
||||
del sort_languages, get_language
|
||||
|
||||
epub_author = u'Kovid Goyal'
|
||||
epub_publisher = u'Kovid Goyal'
|
||||
epub_copyright = u'© {} Kovid Goyal'.format(date.today().year)
|
||||
epub_description = u'Comprehensive documentation for calibre'
|
||||
epub_identifier = u'https://manual.calibre-ebook.com'
|
||||
epub_scheme = u'url'
|
||||
epub_uid = u'S54a88f8e9d42455e9c6db000e989225f'
|
||||
epub_author = 'Kovid Goyal'
|
||||
epub_publisher = 'Kovid Goyal'
|
||||
epub_copyright = '© {} Kovid Goyal'.format(date.today().year)
|
||||
epub_description = 'Comprehensive documentation for calibre'
|
||||
epub_identifier = 'https://manual.calibre-ebook.com'
|
||||
epub_scheme = 'url'
|
||||
epub_uid = 'S54a88f8e9d42455e9c6db000e989225f'
|
||||
epub_tocdepth = 4
|
||||
epub_tocdup = True
|
||||
epub_cover = ('epub_cover.jpg', 'epub_cover_template.html')
|
||||
|
@ -397,7 +397,7 @@ def add_html_context(app, pagename, templatename, context, *args):
|
||||
|
||||
def guilabel_role(typ, rawtext, text, *args, **kwargs):
|
||||
from sphinx.roles import GUILabel
|
||||
text = text.replace(u'->', u'\N{THIN SPACE}\N{RIGHTWARDS ARROW}\N{THIN SPACE}')
|
||||
text = text.replace('->', '\N{THIN SPACE}\N{RIGHTWARDS ARROW}\N{THIN SPACE}')
|
||||
return GUILabel()(typ, rawtext, text, *args, **kwargs)
|
||||
|
||||
|
||||
|
@ -17,11 +17,17 @@ exclude = [
|
||||
quote-style = 'single'
|
||||
|
||||
[lint]
|
||||
ignore = ['E402', 'E722', 'E741']
|
||||
select = ['E', 'F', 'I', 'W', 'INT', 'Q']
|
||||
ignore = ['E402', 'E722', 'E741', 'UP012', 'UP030', 'UP031', 'UP032', 'UP038']
|
||||
select = ['E', 'F', 'I', 'W', 'INT', 'Q', 'UP']
|
||||
|
||||
[lint.per-file-ignores]
|
||||
"recipes/*" = ['UP']
|
||||
"manual/plugin_examples/*" = ['UP']
|
||||
"src/calibre/ebooks/unihandecode/*codepoints.py" = ['E501']
|
||||
"src/calibre/ebooks/metadata/sources/*" = ['UP']
|
||||
"src/calibre/gui2/store/stores/*" = ['UP']
|
||||
"src/calibre/gui2/tts/manager.py" = ['UP037']
|
||||
"src/calibre/utils/copy_files.py" = ['UP037']
|
||||
"src/qt/*.py" = ['I']
|
||||
"src/qt/*.pyi" = ['I']
|
||||
|
||||
|
@ -6,7 +6,7 @@ import os
|
||||
from struct import unpack
|
||||
|
||||
|
||||
class Bookmark(): # {{{
|
||||
class Bookmark: # {{{
|
||||
'''
|
||||
A simple class fetching bookmark data
|
||||
Kindle-specific
|
||||
|
@ -7,7 +7,7 @@ import os
|
||||
from calibre.prints import debug_print
|
||||
|
||||
|
||||
class Bookmark(): # {{{
|
||||
class Bookmark: # {{{
|
||||
'''
|
||||
A simple class fetching bookmark data
|
||||
kobo-specific
|
||||
|
@ -389,7 +389,7 @@ xmtf = (
|
||||
# }}}
|
||||
|
||||
|
||||
class BZZDecoder():
|
||||
class BZZDecoder:
|
||||
|
||||
def __init__(self, infile, outfile):
|
||||
self.instream = infile
|
||||
|
@ -14,7 +14,7 @@ In the process the UTF8 tokens are altered to be supported by the RTF2XML and al
|
||||
'''
|
||||
|
||||
|
||||
class tokenDelimitatorStart():
|
||||
class tokenDelimitatorStart:
|
||||
|
||||
def __init__(self):
|
||||
pass
|
||||
@ -26,7 +26,7 @@ class tokenDelimitatorStart():
|
||||
return '{'
|
||||
|
||||
|
||||
class tokenDelimitatorEnd():
|
||||
class tokenDelimitatorEnd:
|
||||
|
||||
def __init__(self):
|
||||
pass
|
||||
@ -38,7 +38,7 @@ class tokenDelimitatorEnd():
|
||||
return '}'
|
||||
|
||||
|
||||
class tokenControlWord():
|
||||
class tokenControlWord:
|
||||
|
||||
def __init__(self, name, separator=''):
|
||||
self.name = name
|
||||
@ -51,7 +51,7 @@ class tokenControlWord():
|
||||
return self.name + self.separator
|
||||
|
||||
|
||||
class tokenControlWordWithNumericArgument():
|
||||
class tokenControlWordWithNumericArgument:
|
||||
|
||||
def __init__(self, name, argument, separator=''):
|
||||
self.name = name
|
||||
@ -65,7 +65,7 @@ class tokenControlWordWithNumericArgument():
|
||||
return self.name + repr(self.argument) + self.separator
|
||||
|
||||
|
||||
class tokenControlSymbol():
|
||||
class tokenControlSymbol:
|
||||
|
||||
def __init__(self, name):
|
||||
self.name = name
|
||||
@ -77,7 +77,7 @@ class tokenControlSymbol():
|
||||
return self.name
|
||||
|
||||
|
||||
class tokenData():
|
||||
class tokenData:
|
||||
|
||||
def __init__(self, data):
|
||||
self.data = data
|
||||
@ -89,7 +89,7 @@ class tokenData():
|
||||
return self.data
|
||||
|
||||
|
||||
class tokenBinN():
|
||||
class tokenBinN:
|
||||
|
||||
def __init__(self, data, separator=''):
|
||||
self.data = data
|
||||
@ -102,7 +102,7 @@ class tokenBinN():
|
||||
return '\\bin' + repr(len(self.data)) + self.separator + self.data
|
||||
|
||||
|
||||
class token8bitChar():
|
||||
class token8bitChar:
|
||||
|
||||
def __init__(self, data):
|
||||
self.data = data
|
||||
@ -114,7 +114,7 @@ class token8bitChar():
|
||||
return "\\'" + self.data
|
||||
|
||||
|
||||
class tokenUnicode():
|
||||
class tokenUnicode:
|
||||
|
||||
def __init__(self, data, separator='', current_ucn=1, eqList=[]):
|
||||
self.data = data
|
||||
@ -155,7 +155,7 @@ def isString(buffer, string):
|
||||
return buffer == string
|
||||
|
||||
|
||||
class RtfTokenParser():
|
||||
class RtfTokenParser:
|
||||
|
||||
def __init__(self, tokens):
|
||||
self.tokens = tokens
|
||||
@ -256,7 +256,7 @@ class RtfTokenParser():
|
||||
return ''.join(result)
|
||||
|
||||
|
||||
class RtfTokenizer():
|
||||
class RtfTokenizer:
|
||||
|
||||
def __init__(self, rtfData):
|
||||
self.rtfData = []
|
||||
|
@ -151,7 +151,7 @@ class NotesTableWidgetItem(QTableWidgetItem):
|
||||
return self._sort_val < other._sort_val
|
||||
|
||||
|
||||
class NotesUtilities():
|
||||
class NotesUtilities:
|
||||
|
||||
def __init__(self, table, category, item_id_getter):
|
||||
self.table = table
|
||||
|
@ -416,7 +416,7 @@ class WindowsAtomicFolderMove:
|
||||
|
||||
self.close_handles()
|
||||
if e.winerror == winutil.ERROR_SHARING_VIOLATION:
|
||||
err = IOError(errno.EACCES,
|
||||
err = OSError(errno.EACCES,
|
||||
_('File is open in another process'))
|
||||
err.filename = f
|
||||
raise err
|
||||
|
Loading…
x
Reference in New Issue
Block a user