mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
py3: use for loop/hardcode instead of map to process many arguments
Even though we adapted to python3 by using a tuple to ensure the function is actually applied, this still uses a surprising language feature then allocate a tuple that is immediately tossed away.
This commit is contained in:
parent
f7aa4cda79
commit
6ce8e01801
@ -331,7 +331,8 @@ class AddAction(InterfaceAction):
|
||||
create_book(mi, pt.name, fmt=empty_format)
|
||||
fmts = [pt.name]
|
||||
ids.append(db.import_book(mi, fmts))
|
||||
tuple(map(os.remove, orig_fmts))
|
||||
for path in orig_fmts:
|
||||
os.remove(path)
|
||||
self.refresh_gui(num)
|
||||
if ids:
|
||||
ids.reverse()
|
||||
|
@ -12,7 +12,7 @@ from calibre.gui2.actions import InterfaceAction
|
||||
from calibre.gui2.dialogs.smartdevice import SmartdeviceDialog
|
||||
from calibre.utils.icu import primary_sort_key
|
||||
from calibre.utils.smtp import config as email_config
|
||||
from polyglot.builtins import unicode_type, map
|
||||
from polyglot.builtins import unicode_type
|
||||
|
||||
|
||||
class ShareConnMenu(QMenu): # {{{
|
||||
@ -111,7 +111,8 @@ class ShareConnMenu(QMenu): # {{{
|
||||
(alias or account) + ' ' + _('(delete from library)'))
|
||||
self.email_to_menu.addAction(action1)
|
||||
self.email_to_and_delete_menu.addAction(action2)
|
||||
tuple(map(self.memory.append, (action1, action2)))
|
||||
self.memory.append(action1)
|
||||
self.memory.append(action2)
|
||||
if default:
|
||||
ac = DeviceAction(dest, False, False,
|
||||
I('mail.png'), _('Email to') + ' ' +(alias or
|
||||
@ -127,12 +128,14 @@ class ShareConnMenu(QMenu): # {{{
|
||||
_('Select recipients') + ' ' + _('(delete from library)'))
|
||||
self.email_to_menu.addAction(action1)
|
||||
self.email_to_and_delete_menu.addAction(action2)
|
||||
tuple(map(self.memory.append, (action1, action2)))
|
||||
self.memory.append(action1)
|
||||
self.memory.append(action2)
|
||||
tac1 = DeviceAction('choosemail:', False, False, I('mail.png'),
|
||||
_('Email to selected recipients...'))
|
||||
self.addAction(tac1)
|
||||
tac1.a_s.connect(sync_menu.action_triggered)
|
||||
self.memory.append(tac1), self.email_actions.append(tac1)
|
||||
self.memory.append(tac1)
|
||||
self.email_actions.append(tac1)
|
||||
ac = self.addMenu(self.email_to_and_delete_menu)
|
||||
self.email_actions.append(ac)
|
||||
action1.a_s.connect(sync_menu.action_triggered)
|
||||
|
Loading…
x
Reference in New Issue
Block a user