mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
misc cleanup
This commit is contained in:
parent
ac81ccedb3
commit
00559bef8f
@ -108,7 +108,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
|
||||
fmts = config['internally_viewed_formats']
|
||||
viewer = self.opt_internally_viewed_formats
|
||||
viewer.blockSignals(True)
|
||||
exts = set([])
|
||||
exts = set()
|
||||
for ext in BOOK_EXTENSIONS:
|
||||
ext = ext.lower()
|
||||
ext = re.sub(r'(x{0,1})htm(l{0,1})', 'html', ext)
|
||||
|
@ -9,7 +9,7 @@ import textwrap
|
||||
|
||||
from calibre.gui2.preferences import ConfigWidgetBase, test_widget, Setting
|
||||
from calibre.gui2.preferences.misc_ui import Ui_Form
|
||||
from calibre.gui2 import (config, open_local_file, gprefs)
|
||||
from calibre.gui2 import config, open_local_file, gprefs
|
||||
from calibre import get_proxies
|
||||
from polyglot.builtins import iteritems
|
||||
|
||||
|
@ -64,7 +64,7 @@ class PluginModel(QAbstractItemModel, AdaptSQP): # {{{
|
||||
plugins.sort(key=lambda x: x.name.lower())
|
||||
|
||||
def universal_set(self):
|
||||
ans = set([])
|
||||
ans = set()
|
||||
for c, category in enumerate(self.categories):
|
||||
ans.add((c, -1))
|
||||
for p, plugin in enumerate(self._data[category]):
|
||||
@ -74,7 +74,7 @@ class PluginModel(QAbstractItemModel, AdaptSQP): # {{{
|
||||
def get_matches(self, location, query, candidates=None):
|
||||
if candidates is None:
|
||||
candidates = self.universal_set()
|
||||
ans = set([])
|
||||
ans = set()
|
||||
if not query:
|
||||
return ans
|
||||
query = lower(query)
|
||||
|
@ -22,13 +22,13 @@ def sort_key_for_action(ac):
|
||||
q = ac.name if q is None else q[0]
|
||||
return primary_sort_key(force_unicode(q))
|
||||
except Exception:
|
||||
return primary_sort_key(u'')
|
||||
return primary_sort_key('')
|
||||
|
||||
|
||||
class FakeAction(object):
|
||||
|
||||
def __init__(self, name, gui_name, icon, tooltip=None,
|
||||
dont_add_to=frozenset([]), dont_remove_from=frozenset([])):
|
||||
dont_add_to=frozenset(), dont_remove_from=frozenset()):
|
||||
self.name = name
|
||||
self.action_spec = (gui_name, icon, tooltip, None)
|
||||
self.dont_remove_from = dont_remove_from
|
||||
@ -131,7 +131,7 @@ class AllModel(BaseModel):
|
||||
|
||||
def remove(self, indices, allowed):
|
||||
rows = [i.row() for i in indices]
|
||||
remove = set([])
|
||||
remove = set()
|
||||
for row in rows:
|
||||
ac = self._data[row]
|
||||
if ac.name.startswith('---'):
|
||||
@ -181,7 +181,7 @@ class CurrentModel(BaseModel):
|
||||
|
||||
def add(self, names):
|
||||
actions = []
|
||||
reject = set([])
|
||||
reject = set()
|
||||
for name in names:
|
||||
ac = self.name_to_action(name, self.gui)
|
||||
if self.key in ac.dont_add_to:
|
||||
@ -196,7 +196,7 @@ class CurrentModel(BaseModel):
|
||||
|
||||
def remove(self, indices):
|
||||
rows = [i.row() for i in indices]
|
||||
remove, rejected = set([]), set([])
|
||||
remove, rejected = set(), set()
|
||||
for row in rows:
|
||||
ac = self._data[row]
|
||||
if self.key in ac.dont_remove_from:
|
||||
|
@ -417,7 +417,7 @@ def get_devices():
|
||||
|
||||
|
||||
def get_manufacturers():
|
||||
mans = set([])
|
||||
mans = set()
|
||||
for x in get_devices():
|
||||
mans.add(x.manufacturer)
|
||||
if Device.manufacturer in mans:
|
||||
|
@ -536,7 +536,7 @@ class CustomColumns(object):
|
||||
if num is not None:
|
||||
data = self.custom_column_num_map[num]
|
||||
if data['datatype'] == 'composite':
|
||||
return set([])
|
||||
return set()
|
||||
if not data['editable']:
|
||||
raise ValueError('Column %r is not editable'%data['label'])
|
||||
table, lt = self.custom_table_names(data['num'])
|
||||
@ -549,7 +549,7 @@ class CustomColumns(object):
|
||||
if extra is None:
|
||||
extra = 1.0
|
||||
|
||||
books_to_refresh = set([])
|
||||
books_to_refresh = set()
|
||||
if data['normalized']:
|
||||
if data['datatype'] == 'enumeration' and (
|
||||
val and val not in data['display']['enum_values']):
|
||||
@ -563,7 +563,7 @@ class CustomColumns(object):
|
||||
set_val = val if data['is_multiple'] else [val]
|
||||
existing = getter()
|
||||
if not existing:
|
||||
existing = set([])
|
||||
existing = set()
|
||||
else:
|
||||
existing = set(existing)
|
||||
# preserve the order in set_val
|
||||
|
Loading…
x
Reference in New Issue
Block a user