mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
unsorted dunder all/slots (auto-fix)
ruff 'RUF022,RUF023'
This commit is contained in:
parent
88bae18216
commit
d8aecf09ea
@ -20,7 +20,7 @@ quote-style = 'single'
|
|||||||
ignore = [
|
ignore = [
|
||||||
'E402', 'E722', 'E741',
|
'E402', 'E722', 'E741',
|
||||||
'UP012', 'UP030', 'UP032', 'UP038', 'C413', 'C420',
|
'UP012', 'UP030', 'UP032', 'UP038', 'C413', 'C420',
|
||||||
'RUF001', 'RUF002', 'RUF003', 'RUF005', 'RUF010', 'RUF012', 'RUF013', 'RUF015', 'RUF019', 'RUF021', 'RUF022', 'RUF023', 'RUF031', 'RUF034', 'RUF100',
|
'RUF001', 'RUF002', 'RUF003', 'RUF005', 'RUF010', 'RUF012', 'RUF013', 'RUF015', 'RUF019', 'RUF021', 'RUF031', 'RUF034', 'RUF100',
|
||||||
]
|
]
|
||||||
select = [
|
select = [
|
||||||
'E', 'F', 'I', 'W', 'INT',
|
'E', 'F', 'I', 'W', 'INT',
|
||||||
@ -31,6 +31,7 @@ select = [
|
|||||||
[lint.per-file-ignores]
|
[lint.per-file-ignores]
|
||||||
"recipes/*" = ['UP']
|
"recipes/*" = ['UP']
|
||||||
"manual/plugin_examples/*" = ['UP']
|
"manual/plugin_examples/*" = ['UP']
|
||||||
|
"setup/commands.py" = ['RUF022']
|
||||||
"src/calibre/*" = ['UP031']
|
"src/calibre/*" = ['UP031']
|
||||||
"src/calibre/ebooks/unihandecode/*codepoints.py" = ['E501']
|
"src/calibre/ebooks/unihandecode/*codepoints.py" = ['E501']
|
||||||
"src/calibre/ebooks/metadata/sources/*" = ['UP']
|
"src/calibre/ebooks/metadata/sources/*" = ['UP']
|
||||||
|
@ -138,8 +138,13 @@ def load_translations(namespace, zfp):
|
|||||||
class CalibrePluginLoader:
|
class CalibrePluginLoader:
|
||||||
|
|
||||||
__slots__ = (
|
__slots__ = (
|
||||||
'plugin_name', 'fullname_in_plugin', 'zip_file_path', '_is_package', 'names',
|
'_is_package',
|
||||||
'filename', 'all_names'
|
'all_names',
|
||||||
|
'filename',
|
||||||
|
'fullname_in_plugin',
|
||||||
|
'names',
|
||||||
|
'plugin_name',
|
||||||
|
'zip_file_path'
|
||||||
)
|
)
|
||||||
|
|
||||||
def __init__(self, plugin_name, fullname_in_plugin, zip_file_path, names, filename, is_package, all_names):
|
def __init__(self, plugin_name, fullname_in_plugin, zip_file_path, names, filename, is_package, all_names):
|
||||||
|
@ -21,9 +21,23 @@ CATEGORY_SORTS = ('name', 'popularity', 'rating') # This has to be a tuple not
|
|||||||
|
|
||||||
class Tag:
|
class Tag:
|
||||||
|
|
||||||
__slots__ = ('name', 'original_name', 'id', 'count', 'state', 'is_hierarchical',
|
__slots__ = (
|
||||||
'is_editable', 'is_searchable', 'id_set', 'avg_rating', 'sort',
|
'avg_rating',
|
||||||
'use_sort_as_name', 'category', 'search_expression', 'original_categories')
|
'category',
|
||||||
|
'count',
|
||||||
|
'id',
|
||||||
|
'id_set',
|
||||||
|
'is_editable',
|
||||||
|
'is_hierarchical',
|
||||||
|
'is_searchable',
|
||||||
|
'name',
|
||||||
|
'original_categories',
|
||||||
|
'original_name',
|
||||||
|
'search_expression',
|
||||||
|
'sort',
|
||||||
|
'state',
|
||||||
|
'use_sort_as_name',
|
||||||
|
)
|
||||||
|
|
||||||
def __init__(self, name, id=None, count=0, state=0, avg=0, sort=None,
|
def __init__(self, name, id=None, count=0, state=0, avg=0, sort=None,
|
||||||
category=None, id_set=None, search_expression=None,
|
category=None, id_set=None, search_expression=None,
|
||||||
|
@ -471,7 +471,7 @@ class OnDeviceField(OneToOneField):
|
|||||||
|
|
||||||
class LazySortMap:
|
class LazySortMap:
|
||||||
|
|
||||||
__slots__ = ('default_sort_key', 'sort_key_func', 'id_map', 'cache')
|
__slots__ = ('cache', 'default_sort_key', 'id_map', 'sort_key_func')
|
||||||
|
|
||||||
def __init__(self, default_sort_key, sort_key_func, id_map):
|
def __init__(self, default_sort_key, sort_key_func, id_map):
|
||||||
self.default_sort_key = default_sort_key
|
self.default_sort_key = default_sort_key
|
||||||
@ -701,7 +701,7 @@ class FormatsField(ManyToManyField):
|
|||||||
|
|
||||||
class LazySeriesSortMap:
|
class LazySeriesSortMap:
|
||||||
|
|
||||||
__slots__ = ('default_sort_key', 'sort_key_func', 'id_map', 'cache')
|
__slots__ = ('cache', 'default_sort_key', 'id_map', 'sort_key_func')
|
||||||
|
|
||||||
def __init__(self, default_sort_key, sort_key_func, id_map):
|
def __init__(self, default_sort_key, sort_key_func, id_map):
|
||||||
self.default_sort_key = default_sort_key
|
self.default_sort_key = default_sort_key
|
||||||
|
@ -164,7 +164,7 @@ def fixcase(x):
|
|||||||
|
|
||||||
|
|
||||||
class Option:
|
class Option:
|
||||||
__slots__ = ['type', 'default', 'label', 'desc', 'name', 'choices']
|
__slots__ = ['choices', 'default', 'desc', 'label', 'name', 'type']
|
||||||
|
|
||||||
def __init__(self, name, type_, default, label, desc, choices=None):
|
def __init__(self, name, type_, default, label, desc, choices=None):
|
||||||
'''
|
'''
|
||||||
|
@ -22,7 +22,7 @@ _patterns = None
|
|||||||
|
|
||||||
class Patterns:
|
class Patterns:
|
||||||
|
|
||||||
__slots__ = ('sanitize_invisible_pat', 'split_pat', 'digit_pat', 'fr_elision_pat')
|
__slots__ = ('digit_pat', 'fr_elision_pat', 'sanitize_invisible_pat', 'split_pat')
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
import regex
|
import regex
|
||||||
@ -56,7 +56,7 @@ class CharCounter:
|
|||||||
|
|
||||||
class Location:
|
class Location:
|
||||||
|
|
||||||
__slots__ = ('file_name', 'sourceline', 'original_word', 'location_node', 'node_item', 'elided_prefix')
|
__slots__ = ('elided_prefix', 'file_name', 'location_node', 'node_item', 'original_word', 'sourceline')
|
||||||
|
|
||||||
def __init__(self, file_name=None, elided_prefix='', original_word=None, location_node=None, node_item=(None, None)):
|
def __init__(self, file_name=None, elided_prefix='', original_word=None, location_node=None, node_item=(None, None)):
|
||||||
self.file_name, self.elided_prefix, self.original_word = file_name, elided_prefix, original_word
|
self.file_name, self.elided_prefix, self.original_word = file_name, elided_prefix, original_word
|
||||||
|
@ -624,7 +624,7 @@ def make_anchors_unique(container, log):
|
|||||||
|
|
||||||
class AnchorLocation:
|
class AnchorLocation:
|
||||||
|
|
||||||
__slots__ = ('pagenum', 'left', 'top', 'zoom')
|
__slots__ = ('left', 'pagenum', 'top', 'zoom')
|
||||||
|
|
||||||
def __init__(self, pagenum=1, left=0, top=0, zoom=0):
|
def __init__(self, pagenum=1, left=0, top=0, zoom=0):
|
||||||
self.pagenum, self.left, self.top, self.zoom = pagenum, left, top, zoom
|
self.pagenum, self.left, self.top, self.zoom = pagenum, left, top, zoom
|
||||||
|
@ -58,7 +58,7 @@ def painter(func):
|
|||||||
|
|
||||||
class SelectionState:
|
class SelectionState:
|
||||||
|
|
||||||
__slots__ = ('last_press_point', 'current_mode', 'rect', 'in_selection', 'drag_corner', 'dragging', 'last_drag_pos')
|
__slots__ = ('current_mode', 'drag_corner', 'dragging', 'in_selection', 'last_drag_pos', 'last_press_point', 'rect')
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.reset()
|
self.reset()
|
||||||
|
@ -144,7 +144,7 @@ IN_COMMENT_CONTENT = 5
|
|||||||
|
|
||||||
class CSSState:
|
class CSSState:
|
||||||
|
|
||||||
__slots__ = ('parse', 'blocks')
|
__slots__ = ('blocks', 'parse')
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.parse = NORMAL
|
self.parse = NORMAL
|
||||||
|
@ -109,7 +109,7 @@ class Heading(QWidget): # {{{
|
|||||||
|
|
||||||
class Cell: # {{{
|
class Cell: # {{{
|
||||||
|
|
||||||
__slots__ = ('rect', 'text', 'right_align', 'color_role', 'override_color', 'swatch', 'is_overriden')
|
__slots__ = ('color_role', 'is_overriden', 'override_color', 'rect', 'right_align', 'swatch', 'text')
|
||||||
|
|
||||||
SIDE_MARGIN = 5
|
SIDE_MARGIN = 5
|
||||||
FLAGS = Qt.AlignmentFlag.AlignVCenter | Qt.TextFlag.TextSingleLine | Qt.TextFlag.TextIncludeTrailingSpaces
|
FLAGS = Qt.AlignmentFlag.AlignVCenter | Qt.TextFlag.TextSingleLine | Qt.TextFlag.TextIncludeTrailingSpaces
|
||||||
@ -386,7 +386,7 @@ class Box(QWidget):
|
|||||||
|
|
||||||
class Property:
|
class Property:
|
||||||
|
|
||||||
__slots__ = 'name', 'value', 'important', 'color', 'specificity', 'is_overriden'
|
__slots__ = 'color', 'important', 'is_overriden', 'name', 'specificity', 'value'
|
||||||
|
|
||||||
def __init__(self, prop, specificity=()):
|
def __init__(self, prop, specificity=()):
|
||||||
self.name, self.value, self.important, self.color = prop
|
self.name, self.value, self.important, self.color = prop
|
||||||
|
@ -78,7 +78,7 @@ def parse_html(raw):
|
|||||||
|
|
||||||
class ParseItem:
|
class ParseItem:
|
||||||
|
|
||||||
__slots__ = ('name', 'length', 'fingerprint', 'parsing_done', 'parsed_data')
|
__slots__ = ('fingerprint', 'length', 'name', 'parsed_data', 'parsing_done')
|
||||||
|
|
||||||
def __init__(self, name):
|
def __init__(self, name):
|
||||||
self.name = name
|
self.name = name
|
||||||
|
@ -183,9 +183,18 @@ class SearchFinished:
|
|||||||
class SearchResult:
|
class SearchResult:
|
||||||
|
|
||||||
__slots__ = (
|
__slots__ = (
|
||||||
'search_query', 'before', 'text', 'after', 'q', 'spine_idx',
|
'after',
|
||||||
'index', 'file_name', 'is_hidden', 'offset', 'toc_nodes',
|
'before',
|
||||||
'result_num'
|
'file_name',
|
||||||
|
'index',
|
||||||
|
'is_hidden',
|
||||||
|
'offset',
|
||||||
|
'q',
|
||||||
|
'result_num',
|
||||||
|
'search_query',
|
||||||
|
'spine_idx',
|
||||||
|
'text',
|
||||||
|
'toc_nodes'
|
||||||
)
|
)
|
||||||
|
|
||||||
def __init__(self, search_query, before, text, after, q, name, spine_idx, index, offset, result_num):
|
def __init__(self, search_query, before, text, after, q, name, spine_idx, index, offset, result_num):
|
||||||
|
@ -40,7 +40,7 @@ from calibre.utils.localization import _
|
|||||||
|
|
||||||
class Action:
|
class Action:
|
||||||
|
|
||||||
__slots__ = ('icon', 'text', 'shortcut_action')
|
__slots__ = ('icon', 'shortcut_action', 'text')
|
||||||
|
|
||||||
def __init__(self, icon=None, text=None, shortcut_action=None):
|
def __init__(self, icon=None, text=None, shortcut_action=None):
|
||||||
self.icon, self.text, self.shortcut_action = QIcon.ic(icon), text, shortcut_action
|
self.icon, self.text, self.shortcut_action = QIcon.ic(icon), text, shortcut_action
|
||||||
|
@ -32,7 +32,7 @@ not_present = object()
|
|||||||
|
|
||||||
class UserDictionary:
|
class UserDictionary:
|
||||||
|
|
||||||
__slots__ = ('name', 'is_active', 'words')
|
__slots__ = ('is_active', 'name', 'words')
|
||||||
|
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
self.name = kwargs['name']
|
self.name = kwargs['name']
|
||||||
|
@ -134,7 +134,7 @@ class HTTPHeaderParser:
|
|||||||
Headers which are repeated are folded together using a comma if their
|
Headers which are repeated are folded together using a comma if their
|
||||||
specification so dictates.
|
specification so dictates.
|
||||||
'''
|
'''
|
||||||
__slots__ = ('hdict', 'lines', 'finished')
|
__slots__ = ('finished', 'hdict', 'lines')
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.hdict = MultiDict()
|
self.hdict = MultiDict()
|
||||||
|
@ -49,7 +49,7 @@ class ReadBuffer: # {{{
|
|||||||
|
|
||||||
' A ring buffer used to speed up the readline() implementation by minimizing recv() calls '
|
' A ring buffer used to speed up the readline() implementation by minimizing recv() calls '
|
||||||
|
|
||||||
__slots__ = ('ba', 'buf', 'read_pos', 'write_pos', 'full_state')
|
__slots__ = ('ba', 'buf', 'full_state', 'read_pos', 'write_pos')
|
||||||
|
|
||||||
def __init__(self, size=4096):
|
def __init__(self, size=4096):
|
||||||
self.ba = bytearray(size)
|
self.ba = bytearray(size)
|
||||||
|
@ -213,7 +213,7 @@ CategoriesSettings = namedtuple(
|
|||||||
|
|
||||||
class GroupedSearchTerms:
|
class GroupedSearchTerms:
|
||||||
|
|
||||||
__slots__ = ('keys', 'vals', 'hash')
|
__slots__ = ('hash', 'keys', 'vals')
|
||||||
|
|
||||||
def __init__(self, src):
|
def __init__(self, src):
|
||||||
self.keys = frozenset(src)
|
self.keys = frozenset(src)
|
||||||
|
@ -226,7 +226,12 @@ def process_item(ctx, haystack, needle):
|
|||||||
|
|
||||||
class PyScorer:
|
class PyScorer:
|
||||||
__slots__ = (
|
__slots__ = (
|
||||||
'level1', 'level2', 'level3', 'max_score_per_char', 'items', 'memory'
|
'items',
|
||||||
|
'level1',
|
||||||
|
'level2',
|
||||||
|
'level3',
|
||||||
|
'max_score_per_char',
|
||||||
|
'memory'
|
||||||
)
|
)
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
|
@ -54,10 +54,20 @@ from sys import stderr
|
|||||||
|
|
||||||
from polyglot.builtins import string_or_bytes
|
from polyglot.builtins import string_or_bytes
|
||||||
|
|
||||||
__all__ = ['SMTPException', 'SMTPServerDisconnected', 'SMTPResponseException',
|
__all__ = [
|
||||||
'SMTPSenderRefused', 'SMTPRecipientsRefused', 'SMTPDataError',
|
'SMTP',
|
||||||
'SMTPConnectError', 'SMTPHeloError', 'SMTPAuthenticationError',
|
'SMTPAuthenticationError',
|
||||||
'quoteaddr', 'quotedata', 'SMTP']
|
'SMTPConnectError',
|
||||||
|
'SMTPDataError',
|
||||||
|
'SMTPException',
|
||||||
|
'SMTPHeloError',
|
||||||
|
'SMTPRecipientsRefused',
|
||||||
|
'SMTPResponseException',
|
||||||
|
'SMTPSenderRefused',
|
||||||
|
'SMTPServerDisconnected',
|
||||||
|
'quoteaddr',
|
||||||
|
'quotedata',
|
||||||
|
]
|
||||||
|
|
||||||
SMTP_PORT = 25
|
SMTP_PORT = 25
|
||||||
SMTP_SSL_PORT = 465
|
SMTP_SSL_PORT = 465
|
||||||
|
@ -31,12 +31,12 @@ Website : http://chrisarndt.de/en/software/python/threadpool/
|
|||||||
'''
|
'''
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
'makeRequests',
|
|
||||||
'NoResultsPending',
|
'NoResultsPending',
|
||||||
'NoWorkersAvailable',
|
'NoWorkersAvailable',
|
||||||
'ThreadPool',
|
'ThreadPool',
|
||||||
'WorkRequest',
|
'WorkRequest',
|
||||||
'WorkerThread'
|
'WorkerThread',
|
||||||
|
'makeRequests'
|
||||||
]
|
]
|
||||||
|
|
||||||
__author__ = 'Christopher Arndt'
|
__author__ = 'Christopher Arndt'
|
||||||
|
@ -26,8 +26,17 @@ except ImportError:
|
|||||||
zlib = None
|
zlib = None
|
||||||
crc32 = binascii.crc32
|
crc32 = binascii.crc32
|
||||||
|
|
||||||
__all__ = ['BadZipfile', 'error', 'ZIP_STORED', 'ZIP_DEFLATED', 'is_zipfile',
|
__all__ = [
|
||||||
'ZipInfo', 'ZipFile', 'PyZipFile', 'LargeZipFile']
|
'ZIP_DEFLATED',
|
||||||
|
'ZIP_STORED',
|
||||||
|
'BadZipfile',
|
||||||
|
'LargeZipFile',
|
||||||
|
'PyZipFile',
|
||||||
|
'ZipFile',
|
||||||
|
'ZipInfo',
|
||||||
|
'error',
|
||||||
|
'is_zipfile',
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
def decode_zip_internal_file_name(fname, flags):
|
def decode_zip_internal_file_name(fname, flags):
|
||||||
@ -305,26 +314,26 @@ class ZipInfo :
|
|||||||
'''Class with attributes describing each file in the ZIP archive.'''
|
'''Class with attributes describing each file in the ZIP archive.'''
|
||||||
|
|
||||||
__slots__ = (
|
__slots__ = (
|
||||||
'orig_filename',
|
'CRC',
|
||||||
'filename',
|
'_raw_time',
|
||||||
'date_time',
|
|
||||||
'compress_type',
|
|
||||||
'comment',
|
'comment',
|
||||||
'extra',
|
'compress_size',
|
||||||
|
'compress_type',
|
||||||
'create_system',
|
'create_system',
|
||||||
'create_version',
|
'create_version',
|
||||||
'extract_version',
|
'date_time',
|
||||||
'reserved',
|
|
||||||
'flag_bits',
|
|
||||||
'volume',
|
|
||||||
'internal_attr',
|
|
||||||
'external_attr',
|
'external_attr',
|
||||||
'header_offset',
|
'extra',
|
||||||
'CRC',
|
'extract_version',
|
||||||
'compress_size',
|
|
||||||
'file_size',
|
|
||||||
'_raw_time',
|
|
||||||
'file_offset',
|
'file_offset',
|
||||||
|
'file_size',
|
||||||
|
'filename',
|
||||||
|
'flag_bits',
|
||||||
|
'header_offset',
|
||||||
|
'internal_attr',
|
||||||
|
'orig_filename',
|
||||||
|
'reserved',
|
||||||
|
'volume',
|
||||||
)
|
)
|
||||||
|
|
||||||
def __init__(self, filename='NoName', date_time=(1980,1,1,0,0,0)):
|
def __init__(self, filename='NoName', date_time=(1980,1,1,0,0,0)):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user