diff options
author | Anton Khirnov <anton@khirnov.net> | 2021-01-21 09:53:40 +0100 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2021-01-21 09:53:40 +0100 |
commit | f9b1260a6c4dec2c3b4291c7a206e04ec6b691bd (patch) | |
tree | c7ac236bff044dd8ef73ac84d75315793f8884ca /alot/commands | |
parent | 4d467ddda9266627f9c857142ea602d853b57c5e (diff) |
Use super() where applicable.
Diffstat (limited to 'alot/commands')
-rw-r--r-- | alot/commands/envelope.py | 20 | ||||
-rw-r--r-- | alot/commands/globals.py | 31 | ||||
-rw-r--r-- | alot/commands/namedqueries.py | 2 | ||||
-rw-r--r-- | alot/commands/search.py | 4 | ||||
-rw-r--r-- | alot/commands/thread.py | 32 |
5 files changed, 44 insertions, 45 deletions
diff --git a/alot/commands/envelope.py b/alot/commands/envelope.py index 457fe48a..fa45f669 100644 --- a/alot/commands/envelope.py +++ b/alot/commands/envelope.py @@ -44,7 +44,7 @@ class AttachCommand(Command): :param path: files to attach (globable string) :type path: str """ - Command.__init__(self, **kwargs) + super().__init__(**kwargs) self.path = path def apply(self, ui): @@ -74,7 +74,7 @@ class UnattachCommand(Command): :param hint: which attached file to remove :type hint: str """ - Command.__init__(self, **kwargs) + super().__init__(**kwargs) self.hint = hint def apply(self, ui): @@ -98,7 +98,7 @@ class RefineCommand(Command): :param key: key of the header to change :type key: str """ - Command.__init__(self, **kwargs) + super().__init__(**kwargs) self.key = key async def apply(self, ui): @@ -162,7 +162,7 @@ class SendCommand(Command): will be ignored in case the mail parameter is set. :type envelope: alot.db.envelope.envelope """ - Command.__init__(self, **kwargs) + super().__init__(**kwargs) self.mail = mail self.envelope = envelope self.envelope_buffer = None @@ -328,7 +328,7 @@ class EditCommand(Command): self.force_spawn = spawn self.refocus = refocus self.edit_only_body = False - Command.__init__(self, **kwargs) + super().__init__(**kwargs) async def apply(self, ui): ebuffer = ui.current_buffer @@ -435,7 +435,7 @@ class SetCommand(Command): self.key = key self.value = ' '.join(value) self.reset = not append - Command.__init__(self, **kwargs) + super().__init__(**kwargs) async def apply(self, ui): envelope = ui.current_buffer.envelope @@ -462,7 +462,7 @@ class UnsetCommand(Command): :type key: str """ self.key = key - Command.__init__(self, **kwargs) + super().__init__(**kwargs) async def apply(self, ui): del ui.current_buffer.envelope[self.key] @@ -510,7 +510,7 @@ class SignCommand(Command): """ self.action = action self.keyid = keyid - Command.__init__(self, **kwargs) + super().__init__(**kwargs) def apply(self, ui): sign = None @@ -597,7 +597,7 @@ class EncryptCommand(Command): self.encrypt_keys = keyids self.action = action self.trusted = trusted - Command.__init__(self, **kwargs) + super().__init__(**kwargs) async def apply(self, ui): envelope = ui.current_buffer.envelope @@ -671,7 +671,7 @@ class TagCommand(Command): assert isinstance(tags, str), 'tags should be a unicode string' self.tagsstring = tags self.action = action - Command.__init__(self, **kwargs) + super().__init__(**kwargs) def apply(self, ui): ebuffer = ui.current_buffer diff --git a/alot/commands/globals.py b/alot/commands/globals.py index ee49667d..3e53a450 100644 --- a/alot/commands/globals.py +++ b/alot/commands/globals.py @@ -97,7 +97,7 @@ class SearchCommand(Command): """ self.query = ' '.join(query) self.order = sort - Command.__init__(self, **kwargs) + super().__init__(**kwargs) def apply(self, ui): if self.query: @@ -131,7 +131,7 @@ class PromptCommand(Command): :type startwith: str """ self.startwith = startwith - Command.__init__(self, **kwargs) + super().__init__(**kwargs) async def apply(self, ui): logging.info('open command shell') @@ -230,7 +230,7 @@ class ExternalCommand(Command): self.refocus = refocus self.in_thread = thread self.on_success = on_success - Command.__init__(self, **kwargs) + super().__init__(**kwargs) async def apply(self, ui): logging.debug('cmdlist: %s', self.cmdlist) @@ -341,9 +341,8 @@ class EditCommand(ExternalCommand): self.cmdlist = split_commandstring(editor_cmdstring) + [path] logging.debug({'spawn: ': self.spawn, 'in_thread': self.thread}) - ExternalCommand.__init__(self, self.cmdlist, - spawn=self.spawn, thread=self.thread, - **kwargs) + super().__init__(self.cmdlist, spawn = self.spawn, thread = self.thread, + **kwargs) async def apply(self, ui): if self.cmdlist is None: @@ -368,7 +367,7 @@ class RepeatCommand(Command): """repeat the command executed last time""" def __init__(self, **kwargs): - Command.__init__(self, **kwargs) + super().__init__(**kwargs) async def apply(self, ui): if ui.last_commandline is not None: @@ -389,7 +388,7 @@ class CallCommand(Command): :param command: python command string to call :type command: str """ - Command.__init__(self, **kwargs) + super().__init__(**kwargs) self.command = command async def apply(self, ui): @@ -431,7 +430,7 @@ class BufferCloseCommand(Command): self.buffer = buffer self.force = force self.redraw = redraw - Command.__init__(self, **kwargs) + super().__init__(**kwargs) async def apply(self, ui): async def one_buffer(prompt=True): @@ -503,7 +502,7 @@ class BufferFocusCommand(Command): self.buffer = buffer self.index = index self.offset = offset - Command.__init__(self, **kwargs) + super().__init__(**kwargs) def apply(self, ui): if self.buffer is None: @@ -530,7 +529,7 @@ class OpenBufferlistCommand(Command): :type filtfun: callable (str->bool) """ self.filtfun = filtfun - Command.__init__(self, **kwargs) + super().__init__(**kwargs) def apply(self, ui): blists = ui.get_buffers_of_type(buffers.BufferlistBuffer) @@ -549,7 +548,7 @@ class TagListCommand(Command): """opens taglist buffer""" def __init__(self, tags=None, **kwargs): self.tags = tags - Command.__init__(self, **kwargs) + super().__init__(**kwargs) def apply(self, ui): tags = frozenset(self.tags) if self.tags else ui.dbman.get_all_tags() @@ -572,7 +571,7 @@ class NamedQueriesCommand(Command): :type filtfun: callable (str->bool) """ self.filtfun = filtfun - Command.__init__(self, **kwargs) + super().__init__(**kwargs) def apply(self, ui): ui.buffer_open(buffers.NamedQueriesBuffer(ui.dbman, self.filtfun)) @@ -589,7 +588,7 @@ class HelpCommand(Command): :param commandname: command to document :type commandname: str """ - Command.__init__(self, **kwargs) + super().__init__(**kwargs) self.commandname = commandname def apply(self, ui): @@ -709,7 +708,7 @@ class ComposeCommand(Command): :type encrypt: bool """ - Command.__init__(self, **kwargs) + super().__init__(**kwargs) self.envelope = envelope self.template = template @@ -998,7 +997,7 @@ class MoveCommand(Command): self.movement = '' else: self.movement = ' '.join(movement) - Command.__init__(self, **kwargs) + super().__init__(**kwargs) def apply(self, ui): if self.movement in ['up', 'down', 'page up', 'page down']: diff --git a/alot/commands/namedqueries.py b/alot/commands/namedqueries.py index f10724a8..e2bc301b 100644 --- a/alot/commands/namedqueries.py +++ b/alot/commands/namedqueries.py @@ -18,7 +18,7 @@ class NamedqueriesSelectCommand(Command): """search for messages with selected query""" def __init__(self, filt=None, **kwargs): self._filt = filt - Command.__init__(self, **kwargs) + super().__init__(**kwargs) async def apply(self, ui): query_name = ui.current_buffer.get_selected_query() diff --git a/alot/commands/search.py b/alot/commands/search.py index 762e9ec8..14f267cd 100644 --- a/alot/commands/search.py +++ b/alot/commands/search.py @@ -56,7 +56,7 @@ class RefineCommand(Command): else: self.querystring = ' '.join(query) self.sort_order = sort - Command.__init__(self, **kwargs) + super().__init__(**kwargs) def apply(self, ui): if self.querystring or self.sort_order: @@ -141,7 +141,7 @@ class TagCommand(Command): self.tagsstring = tags self.action = action self.allm = allmessages - Command.__init__(self, **kwargs) + super().__init__(**kwargs) async def apply(self, ui): searchbuffer = ui.current_buffer diff --git a/alot/commands/thread.py b/alot/commands/thread.py index 7523f46b..84b1c611 100644 --- a/alot/commands/thread.py +++ b/alot/commands/thread.py @@ -151,7 +151,7 @@ class ReplyCommand(Command): self.groupreply = all self.listreply = listreply self.force_spawn = spawn - Command.__init__(self, **kwargs) + super().__init__(**kwargs) async def apply(self, ui): # get message to reply to if not given in constructor @@ -325,7 +325,7 @@ class ForwardCommand(Command): self.message = message self.inline = not attach self.force_spawn = spawn - Command.__init__(self, **kwargs) + super().__init__(**kwargs) async def apply(self, ui): # get message to forward if not given in constructor @@ -406,7 +406,7 @@ class BounceMailCommand(Command): :type message: `alot.db.message.Message` """ self.message = message - Command.__init__(self, **kwargs) + super().__init__(**kwargs) async def apply(self, ui): # get mail to bounce @@ -473,7 +473,7 @@ class EditNewCommand(Command): """ self.message = message self.force_spawn = spawn - Command.__init__(self, **kwargs) + super().__init__(**kwargs) async def apply(self, ui): if not self.message: @@ -556,7 +556,7 @@ class ChangeDisplaymodeCommand(Command): self.fold = fold self.weight = weight self.cycle_alt = cycle_alt - Command.__init__(self, **kwargs) + super().__init__(**kwargs) def apply(self, ui): tbuffer = ui.current_buffer @@ -681,7 +681,7 @@ class PipeCommand(Command): :param done_msg: notification message to show upon success :type done_msg: str """ - Command.__init__(self, **kwargs) + super().__init__(**kwargs) if isinstance(cmd, str): cmd = split_commandstring(cmd) self.cmd = cmd @@ -825,13 +825,13 @@ class PrintCommand(PipeCommand): noop_msg = 'no print command specified. Set "print_cmd" in the '\ 'global section.' - PipeCommand.__init__(self, [cmd], all=all, separately=separately, - background=True, - shell=False, - format='raw' if raw else 'decoded', - add_tags=add_tags, - noop_msg=noop_msg, confirm_msg=confirm_msg, - done_msg=ok_msg, **kwargs) + super().__init__([cmd], all=all, separately=separately, + background=True, + shell=False, + format='raw' if raw else 'decoded', + add_tags=add_tags, + noop_msg=noop_msg, confirm_msg=confirm_msg, + done_msg=ok_msg, **kwargs) @registerCommand(MODE, 'save', arguments=[ @@ -848,7 +848,7 @@ class SaveAttachmentCommand(Command): directory. :type path: str """ - Command.__init__(self, **kwargs) + super().__init__(**kwargs) self.all = all self.path = path @@ -903,7 +903,7 @@ class OpenAttachmentCommand(Command): :param attachment: attachment to open :type attachment: :class:`~alot.db.attachment.Attachment` """ - Command.__init__(self, **kwargs) + super().__init__(**kwargs) self.attachment = attachment async def apply(self, ui): @@ -1085,7 +1085,7 @@ class TagCommand(Command): self.tagsstring = tags self.all = all self.action = action - Command.__init__(self, **kwargs) + super().__init__(**kwargs) async def apply(self, ui): if self.all: |