diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2016-12-20 12:12:07 -0800 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2016-12-21 17:18:39 -0800 |
commit | 41ef1f14636caf213e7c25dc3eeb3d911418ee72 (patch) | |
tree | 75d34e6edaecaf3ad66fb544e0cd7a996fd4ad4d /alot | |
parent | bf2005c111289fcd7f55b92e64cfa8c43b9bfdbc (diff) |
Replace unused arguments with _
This patch replaces a large number (but not all) unused arguments with
the standard ``_`` placeholder. This has the advantage of signaling that
these values are unused.
There are a number of places that I've chosen not to apply this, largely
in methods that have publicly define signatures that they inherit
(usually from urwid).
Diffstat (limited to 'alot')
-rw-r--r-- | alot/account.py | 2 | ||||
-rw-r--r-- | alot/buffers.py | 6 | ||||
-rw-r--r-- | alot/commands/bufferlist.py | 2 | ||||
-rw-r--r-- | alot/commands/envelope.py | 6 | ||||
-rw-r--r-- | alot/commands/globals.py | 6 | ||||
-rw-r--r-- | alot/commands/thread.py | 5 | ||||
-rw-r--r-- | alot/completion.py | 4 | ||||
-rw-r--r-- | alot/db/manager.py | 3 | ||||
-rw-r--r-- | alot/db/utils.py | 5 | ||||
-rw-r--r-- | alot/helper.py | 2 | ||||
-rw-r--r-- | alot/ui.py | 14 |
11 files changed, 26 insertions, 29 deletions
diff --git a/alot/account.py b/alot/account.py index cabd487e..912380e3 100644 --- a/alot/account.py +++ b/alot/account.py @@ -55,7 +55,7 @@ class Account(object): sent_box=None, sent_tags=None, draft_box=None, draft_tags=None, abook=None, sign_by_default=False, encrypt_by_default=u"none", - **rest): + **_): sent_tags = sent_tags or [] if 'sent' not in sent_tags: sent_tags.append('sent') diff --git a/alot/buffers.py b/alot/buffers.py index 579fc029..430d53cd 100644 --- a/alot/buffers.py +++ b/alot/buffers.py @@ -106,7 +106,7 @@ class BufferlistBuffer(Buffer): def get_selected_buffer(self): """returns currently selected :class:`Buffer` element from list""" - (linewidget, pos) = self.bufferlist.get_focus() + linewidget, _ = self.bufferlist.get_focus() bufferlinewidget = linewidget.get_focus().original_widget return bufferlinewidget.get_buffer() @@ -279,7 +279,7 @@ class SearchBuffer(Buffer): returns curently focussed :class:`alot.widgets.ThreadlineWidget` from the result list. """ - (threadlinewidget, size) = self.threadlist.get_focus() + threadlinewidget, _ = self.threadlist.get_focus() return threadlinewidget def get_selected_thread(self): @@ -668,6 +668,6 @@ class TagListBuffer(Buffer): def get_selected_tag(self): """returns selected tagstring""" - (cols, pos) = self.taglist.get_focus() + cols, _ = self.taglist.get_focus() tagwidget = cols.original_widget.get_focus() return tagwidget.get_tag() diff --git a/alot/commands/bufferlist.py b/alot/commands/bufferlist.py index e78663ec..73bd12a4 100644 --- a/alot/commands/bufferlist.py +++ b/alot/commands/bufferlist.py @@ -23,7 +23,7 @@ class BufferCloseCommand(Command): selected = bufferlist.get_selected_buffer() d = ui.apply_command(globals.BufferCloseCommand(buffer=selected)) - def cb(ignoreme): + def cb(_): if bufferlist is not selected: bufferlist.rebuild() ui.update() diff --git a/alot/commands/envelope.py b/alot/commands/envelope.py index 062b059e..69b63f3a 100644 --- a/alot/commands/envelope.py +++ b/alot/commands/envelope.py @@ -115,7 +115,7 @@ class SaveCommand(Command): envelope = ui.current_buffer.envelope # determine account to use - sname, saddr = email.Utils.parseaddr(envelope.get('From')) + _, saddr = email.Utils.parseaddr(envelope.get('From')) account = settings.get_account_by_address(saddr) if account is None: if not settings.get_accounts(): @@ -215,7 +215,7 @@ class SendCommand(Command): msg = self.mail if not isinstance(msg, email.message.Message): msg = email.message_from_string(self.mail) - sname, saddr = email.Utils.parseaddr(msg.get('From', '')) + _, saddr = email.Utils.parseaddr(msg.get('From', '')) account = settings.get_account_by_address(saddr) if account is None: if not settings.get_accounts(): @@ -230,7 +230,7 @@ class SendCommand(Command): self.mail = str(self.mail) # define callback - def afterwards(returnvalue): + def afterwards(_): initial_tags = [] if self.envelope is not None: self.envelope.sending = False diff --git a/alot/commands/globals.py b/alot/commands/globals.py index 27bac072..294abcd4 100644 --- a/alot/commands/globals.py +++ b/alot/commands/globals.py @@ -241,7 +241,7 @@ class ExternalCommand(Command): logging.info('calling external command: %s', self.cmdlist) - def thread_code(*args): + def thread_code(*_): try: if stdin is None: proc = subprocess.Popen(self.cmdlist, shell=self.shell, @@ -252,7 +252,7 @@ class ExternalCommand(Command): proc = subprocess.Popen(self.cmdlist, shell=self.shell, stdin=subprocess.PIPE, stderr=subprocess.PIPE) - out, err = proc.communicate(stdin.read()) + _, err = proc.communicate(stdin.read()) ret = proc.wait() if ret == 0: return 'success' @@ -547,7 +547,7 @@ class FlushCommand(Command): timeout = settings.get('flush_retry_timeout') if timeout > 0: - def f(*args): + def f(*_): self.apply(ui) ui.mainloop.set_alarm_in(timeout, f) if not ui.db_was_locked: diff --git a/alot/commands/thread.py b/alot/commands/thread.py index 2aa96cf8..90b68960 100644 --- a/alot/commands/thread.py +++ b/alot/commands/thread.py @@ -183,7 +183,7 @@ class ReplyCommand(Command): # set From-header and sending account try: - from_header, account = determine_sender(mail, 'reply') + from_header, _ = determine_sender(mail, 'reply') except AssertionError as e: ui.notify(e.message, priority='error') return @@ -373,7 +373,7 @@ class ForwardCommand(Command): # set From-header and sending account try: - from_header, account = determine_sender(mail, 'reply') + from_header, _ = determine_sender(mail, 'reply') except AssertionError as e: ui.notify(e.message, priority='error') return @@ -471,7 +471,6 @@ class EditNewCommand(Command): self.message = ui.current_buffer.get_selected_message() mail = self.message.get_email() # set body text - name, address = self.message.get_author() mailcontent = self.message.accumulate_body() envelope = Envelope(bodytext=mailcontent) diff --git a/alot/completion.py b/alot/completion.py index 2e643e37..314fa0c6 100644 --- a/alot/completion.py +++ b/alot/completion.py @@ -108,7 +108,7 @@ class MultipleSelectionCompleter(Completer): def complete(self, original, pos): mypart, start, end, mypos = self.relevant_part(original, pos) res = [] - for c, p in self._completer.complete(mypart, mypos): + for c, _ in self._completer.complete(mypart, mypos): newprefix = original[:start] + c if not original[end:].startswith(self._separator): newprefix += self._separator @@ -135,7 +135,7 @@ class QueryCompleter(Completer): myprefix = mypart[:mypos] m = re.search(r'(tag|is|to|from):(\w*)', myprefix) if m: - cmd, params = m.groups() + cmd, _ = m.groups() cmdlen = len(cmd) + 1 # length of the keyword part incld colon if cmd in ['to', 'from']: localres = self._abookscompleter.complete(mypart[cmdlen:], diff --git a/alot/db/manager.py b/alot/db/manager.py index 3520ee63..7f2cf7eb 100644 --- a/alot/db/manager.py +++ b/alot/db/manager.py @@ -138,8 +138,7 @@ class DBManager(object): if cmd == 'add': logging.debug('add') path, tags = current_item[2:] - msg, status = db.add_message(path, - sync_maildir_flags=sync) + msg, _ = db.add_message(path, sync_maildir_flags=sync) logging.debug('added msg') msg.freeze() logging.debug('freeze') diff --git a/alot/db/utils.py b/alot/db/utils.py index 9c325247..9541c881 100644 --- a/alot/db/utils.py +++ b/alot/db/utils.py @@ -302,7 +302,7 @@ def extract_body(mail, types=None, field_key='copiousoutput'): body_parts.append(string_sanitize(raw_payload)) else: # get mime handler - handler, entry = settings.mailcap_find_match(ctype, key=field_key) + _, entry = settings.mailcap_find_match(ctype, key=field_key) tempfile_name = None stdin = None @@ -332,8 +332,7 @@ def extract_body(mail, types=None, field_key='copiousoutput'): logging.debug('parms: %s', str(parms)) cmdlist = split_commandstring(cmd) # call handler - rendered_payload, errmsg, retval = helper.call_cmd( - cmdlist, stdin=stdin) + rendered_payload, _, _ = helper.call_cmd(cmdlist, stdin=stdin) # remove tempfile if tempfile_name: diff --git a/alot/helper.py b/alot/helper.py index 253fa899..1326f97e 100644 --- a/alot/helper.py +++ b/alot/helper.py @@ -457,7 +457,7 @@ def mimewrap(path, filename=None, ctype=None): # as distributions still ship libmagic 5.11. if (ctype == 'application/msword' and not libmagic_version_at_least(513)): - mimetype, encoding = mimetypes.guess_type(path) + mimetype, _ = mimetypes.guess_type(path) if mimetype: ctype = mimetype @@ -138,12 +138,12 @@ class UI(object): # otherwise interpret keybinding else: # define callback that resets input queue - def clear(*args): + def clear(*_): if self._alarm is not None: self.mainloop.remove_alarm(self._alarm) self.input_queue = [] - def fire(ignored, cmdline): + def fire(_, cmdline): clear() logging.debug("cmdline: '%s'", cmdline) if not self._locked: @@ -210,7 +210,7 @@ class UI(object): # one callback may return a Deferred and thus postpone the application # of the next callback (and thus Command-application) - def apply_this_command(ignored, cmdstring): + def apply_this_command(_, cmdstring): logging.debug('%s command string: "%s"', self.mode, str(cmdstring)) # translate cmdstring into :class:`Command` cmd = commandfactory(cmdstring, self.mode) @@ -308,7 +308,7 @@ class UI(object): edit_text=text, history=history, on_error=cerror) - for i in range(tab): # hit some tabs + for _ in range(tab): # hit some tabs editpart.keypress((0,), 'tab') # build promptwidget @@ -559,7 +559,7 @@ class UI(object): self._notificationbar = urwid.Pile(newpile) self.update() - def clear(*args): + def clear(*_): self.clear_notify(msgs) if block: @@ -649,7 +649,7 @@ class UI(object): """ if cmd: # define (callback) function that invokes post-hook - def call_posthook(retval_from_apply): + def call_posthook(_): if cmd.posthook: logging.info('calling post-hook') return defer.maybeDeferred(cmd.posthook, @@ -658,7 +658,7 @@ class UI(object): cmd=cmd) # call cmd.apply - def call_apply(ignored): + def call_apply(_): return defer.maybeDeferred(cmd.apply, self) prehook = cmd.prehook or (lambda **kwargs: None) |