diff options
author | Ben Finney <ben+python@benfinney.id.au> | 2018-04-23 16:30:28 +1000 |
---|---|---|
committer | Ben Finney <ben@benfinney.id.au> | 2018-04-23 19:54:46 +1000 |
commit | 018279b18e7c95b40d94a09fc68fa3b3aa1fc6b0 (patch) | |
tree | 219ede6fac37dfa3a35027dfef75c68ac689c409 /alot | |
parent | 950839f390dbdcd285ceae86b7ddeb4ce62a50d4 (diff) |
Wrap long statements on open-bracket syntax.
Diffstat (limited to 'alot')
-rw-r--r-- | alot/account.py | 8 | ||||
-rw-r--r-- | alot/commands/globals.py | 21 | ||||
-rw-r--r-- | alot/commands/thread.py | 13 | ||||
-rw-r--r-- | alot/crypto.py | 5 | ||||
-rw-r--r-- | alot/db/envelope.py | 14 | ||||
-rw-r--r-- | alot/db/utils.py | 3 | ||||
-rw-r--r-- | alot/ui.py | 11 |
7 files changed, 46 insertions, 29 deletions
diff --git a/alot/account.py b/alot/account.py index 461d2bbf..fe304ac6 100644 --- a/alot/account.py +++ b/alot/account.py @@ -213,9 +213,11 @@ class Account(object): replied_tags = replied_tags or [] passed_tags = passed_tags or [] - self.address = Address.from_string(address, case_sensitive=case_sensitive_username) - self.aliases = [Address.from_string(a, case_sensitive=case_sensitive_username) - for a in (aliases or [])] + self.address = Address.from_string( + address, case_sensitive=case_sensitive_username) + self.aliases = [ + Address.from_string(a, case_sensitive=case_sensitive_username) + for a in (aliases or [])] self.alias_regexp = alias_regexp self.realname = realname self.encrypt_to_self = encrypt_to_self diff --git a/alot/commands/globals.py b/alot/commands/globals.py index d335e8cf..4e272b8e 100644 --- a/alot/commands/globals.py +++ b/alot/commands/globals.py @@ -271,9 +271,10 @@ class ExternalCommand(Command): def thread_code(*_): try: - proc = subprocess.Popen(self.cmdlist, shell=self.shell, - stdin=subprocess.PIPE if stdin else None, - stderr=subprocess.PIPE) + proc = subprocess.Popen( + self.cmdlist, shell=self.shell, + stdin=subprocess.PIPE if stdin else None, + stderr=subprocess.PIPE) except OSError as e: return str(e) @@ -623,8 +624,8 @@ class HelpCommand(Command): globalmaps, modemaps = settings.get_keybindings(ui.mode) # build table - maxkeylength = len(max(list(modemaps.keys()) + list(globalmaps.keys()), - key=len)) + maxkeylength = len( + max(list(modemaps.keys()) + list(globalmaps.keys()), key=len)) keycolumnwidth = maxkeylength + 2 linewidgets = [] @@ -689,10 +690,12 @@ class HelpCommand(Command): class ComposeCommand(Command): """compose a new email""" - def __init__(self, envelope=None, headers=None, template=None, sender=u'', - tags=None, subject=u'', to=None, cc=None, bcc=None, attach=None, - omit_signature=False, spawn=None, rest=None, encrypt=False, - **kwargs): + def __init__( + self, + envelope=None, headers=None, template=None, sender=u'', + tags=None, subject=u'', to=None, cc=None, bcc=None, attach=None, + omit_signature=False, spawn=None, rest=None, encrypt=False, + **kwargs): """ :param envelope: use existing envelope :type envelope: :class:`~alot.db.envelope.Envelope` diff --git a/alot/commands/thread.py b/alot/commands/thread.py index a6380ac9..6a631e62 100644 --- a/alot/commands/thread.py +++ b/alot/commands/thread.py @@ -72,13 +72,16 @@ def determine_sender(mail, action='reply'): # pick the most important account that has an address in candidates # and use that accounts realname and the address found here for account in my_accounts: - acc_addresses = [re.escape(str(a)) for a in account.get_addresses()] + acc_addresses = [ + re.escape(str(a)) for a in account.get_addresses()] if account.alias_regexp is not None: acc_addresses.append(account.alias_regexp) for alias in acc_addresses: regex = re.compile( u'^' + str(alias) + u'$', - flags=re.IGNORECASE if not account.address.case_sensitive else 0) + flags=( + re.IGNORECASE if not account.address.case_sensitive + else 0)) for seen_name, seen_address in candidate_addresses: if regex.match(seen_address): logging.debug("match!: '%s' '%s'", seen_address, alias) @@ -241,7 +244,11 @@ class ReplyCommand(Command): # Reply-To is standart reply target RFC 2822:, RFC 1036: 2.2.1 # X-BeenThere is needed by sourceforge ML also winehq # X-Mailing-List is also standart and is used by git-send-mail - to = mail['Reply-To'] or mail['X-BeenThere'] or mail['X-Mailing-List'] + to = ( + mail['Reply-To'] + or mail['X-BeenThere'] + or mail['X-Mailing-List'] + ) # Some mail server (gmail) will not resend you own mail, so you # have to deal with the one in sent if to is None: diff --git a/alot/crypto.py b/alot/crypto.py index 247dbd19..e7e0bd36 100644 --- a/alot/crypto.py +++ b/alot/crypto.py @@ -112,8 +112,9 @@ def get_key(keyid, validate=False, encrypt=False, sign=False, else: raise e # pragma: nocover if signed_only and not check_uid_validity(key, keyid): - raise GPGProblem('Cannot find a trusworthy key for "{}".'.format(keyid), - code=GPGCode.NOT_FOUND) + raise GPGProblem( + 'Cannot find a trusworthy key for "{}".'.format(keyid), + code=GPGCode.NOT_FOUND) return key diff --git a/alot/db/envelope.py b/alot/db/envelope.py index b742ba81..89a99ffa 100644 --- a/alot/db/envelope.py +++ b/alot/db/envelope.py @@ -223,9 +223,10 @@ class Envelope(object): # wrap signature in MIMEcontainter stype = 'pgp-signature; name="signature.asc"' - signature_mime = MIMEApplication(_data=signature_str.decode('ascii'), - _subtype=stype, - _encoder=encode_7or8bit) + signature_mime = MIMEApplication( + _data=signature_str.decode('ascii'), + _subtype=stype, + _encoder=encode_7or8bit) signature_mime['Content-Description'] = 'signature' signature_mime.set_charset('us-ascii') @@ -255,9 +256,10 @@ class Envelope(object): _encoder=encode_7or8bit) encryption_mime.set_charset('us-ascii') - encrypted_mime = MIMEApplication(_data=encrypted_str.decode('ascii'), - _subtype='octet-stream', - _encoder=encode_7or8bit) + encrypted_mime = MIMEApplication( + _data=encrypted_str.decode('ascii'), + _subtype='octet-stream', + _encoder=encode_7or8bit) encrypted_mime.set_charset('us-ascii') outer_msg.attach(encryption_mime) outer_msg.attach(encrypted_mime) diff --git a/alot/db/utils.py b/alot/db/utils.py index ba32b832..3ed88c74 100644 --- a/alot/db/utils.py +++ b/alot/db/utils.py @@ -364,7 +364,8 @@ def extract_body(mail, types=None, field_key='copiousoutput'): elif cte == 'base64': raw_payload = base64.b64decode(payload) else: - raise Exception('Unknown Content-Transfer-Encoding {}'.format(cte)) + raise Exception( + 'Unknown Content-Transfer-Encoding {}'.format(cte)) # message.get_payload(decode=True) also handles a number of unicode # encodindigs. maybe those are useful? payload = raw_payload.decode(enc) @@ -103,11 +103,12 @@ class UI(object): self._recipients_hist_file, size=size) # set up main loop - self.mainloop = urwid.MainLoop(self.root_widget, - handle_mouse=settings.get('handle_mouse'), - event_loop=urwid.TwistedEventLoop(), - unhandled_input=self._unhandled_input, - input_filter=self._input_filter) + self.mainloop = urwid.MainLoop( + self.root_widget, + handle_mouse=settings.get('handle_mouse'), + event_loop=urwid.TwistedEventLoop(), + unhandled_input=self._unhandled_input, + input_filter=self._input_filter) # Create a defered that calls the loop_hook loop_hook = settings.get_hook('loop_hook') |