misc cleanup set([])

This commit is contained in:
Eli Schwartz 2019-08-05 16:07:00 -04:00
parent 06755d5eba
commit 24cd46cc70
No known key found for this signature in database
GPG Key ID: CEB167EFB5722BD6
4 changed files with 5 additions and 5 deletions

View File

@ -85,7 +85,7 @@ class GenerateCatalogAction(InterfaceAction):
id = self.gui.library_view.model().add_catalog(job.catalog_file_path, job.catalog_title) id = self.gui.library_view.model().add_catalog(job.catalog_file_path, job.catalog_title)
self.gui.library_view.model().beginResetModel(), self.gui.library_view.model().endResetModel() self.gui.library_view.model().beginResetModel(), self.gui.library_view.model().endResetModel()
if job.catalog_sync: if job.catalog_sync:
sync = dynamic.get('catalogs_to_be_synced', set([])) sync = dynamic.get('catalogs_to_be_synced', set())
sync.add(id) sync.add(id)
dynamic.set('catalogs_to_be_synced', sync) dynamic.set('catalogs_to_be_synced', sync)
self.gui.status_bar.show_message(_('Catalog generated.'), 3000) self.gui.status_bar.show_message(_('Catalog generated.'), 3000)

View File

@ -165,7 +165,7 @@ class DeleteAction(InterfaceAction):
if not rows or len(rows) == 0: if not rows or len(rows) == 0:
d = error_dialog(self.gui, err_title, _('No book selected')) d = error_dialog(self.gui, err_title, _('No book selected'))
d.exec_() d.exec_()
return set([]) return set()
return set(map(self.gui.library_view.model().id, rows)) return set(map(self.gui.library_view.model().id, rows))
def remove_format_by_id(self, book_id, fmt): def remove_format_by_id(self, book_id, fmt):

View File

@ -166,7 +166,7 @@ class ViewAction(InterfaceAction):
rows = [r.row() for r in rows] rows = [r.row() for r in rows]
book_ids = [db.id(r) for r in rows] book_ids = [db.id(r) for r in rows]
formats = [[x.upper() for x in db.new_api.formats(book_id)] for book_id in book_ids] formats = [[x.upper() for x in db.new_api.formats(book_id)] for book_id in book_ids]
all_fmts = set([]) all_fmts = set()
for x in formats: for x in formats:
if x: if x:
for f in x: for f in x:

View File

@ -1343,7 +1343,7 @@ class DeviceMixin(object): # {{{
self.iactions['Convert Books'].auto_convert_catalogs(auto, format) self.iactions['Convert Books'].auto_convert_catalogs(auto, format)
files = [f for f in files if f is not None] files = [f for f in files if f is not None]
if not files: if not files:
dynamic.set('catalogs_to_be_synced', set([])) dynamic.set('catalogs_to_be_synced', set())
return return
metadata = self.library_view.model().metadata_for(ids) metadata = self.library_view.model().metadata_for(ids)
names = [] names = []
@ -1355,7 +1355,7 @@ class DeviceMixin(object): # {{{
names.append('%s_%d%s'%(prefix, id, names.append('%s_%d%s'%(prefix, id,
os.path.splitext(files[-1])[1])) os.path.splitext(files[-1])[1]))
self.update_thumbnail(mi) self.update_thumbnail(mi)
dynamic.set('catalogs_to_be_synced', set([])) dynamic.set('catalogs_to_be_synced', set())
if files: if files:
remove = [] remove = []
space = {self.location_manager.free[0] : None, space = {self.location_manager.free[0] : None,