misc cleanup

This commit is contained in:
Eli Schwartz 2019-09-01 23:12:54 -04:00 committed by Kovid Goyal
parent ac81ccedb3
commit 00559bef8f
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
6 changed files with 13 additions and 13 deletions

View File

@ -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)

View File

@ -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

View File

@ -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)

View File

@ -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:

View File

@ -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:

View File

@ -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