From adc5d6038e50a12a4fe3e5ee97340904295e1d40 Mon Sep 17 00:00:00 2001 From: Patrick Totzke Date: Mon, 17 Dec 2012 11:36:39 +0000 Subject: pep8 fixes --- alot/buffers.py | 6 +++--- alot/commands/envelope.py | 14 +++++++------- alot/crypto.py | 9 +++++---- alot/db/envelope.py | 1 - 4 files changed, 15 insertions(+), 15 deletions(-) (limited to 'alot') diff --git a/alot/buffers.py b/alot/buffers.py index 50cbd0c3..bd8a9e82 100644 --- a/alot/buffers.py +++ b/alot/buffers.py @@ -155,7 +155,7 @@ class EnvelopeBuffer(Buffer): if self.envelope.encrypt: description = 'Yes' encrypt_keys = self.envelope.encrypt_keys.values() - if len(encrypt_keys) == 1: + if len(encrypt_keys) == 1: description += ', with key ' elif len(encrypt_keys) > 1: description += ', with keys ' @@ -395,8 +395,8 @@ class ThreadBuffer(Buffer): # let urwid.ListBox focus this widget: # The first parameter is a "size" tuple: that needs only to # be iterable an is *never* used. i is the integer index - # to focus. offset_inset is may be used to shift the visible area - # so that the focus lies at given offset + # to focus. offset_inset is may be used to shift the + # visible area so that the focus lies at given offset self.body.change_focus((0, 0), i, offset_inset=0, coming_from='above') diff --git a/alot/commands/envelope.py b/alot/commands/envelope.py index 81aeeb8e..26b87381 100644 --- a/alot/commands/envelope.py +++ b/alot/commands/envelope.py @@ -453,16 +453,16 @@ class SignCommand(Command): @registerCommand(MODE, 'encrypt', forced={'action': 'encrypt'}, arguments=[ - (['keyids'], {'nargs':argparse.REMAINDER, - 'help': 'keyid of the key to encrypt with'})]) + (['keyids'], {'nargs':argparse.REMAINDER, + 'help': 'keyid of the key to encrypt with'})]) @registerCommand(MODE, 'unencrypt', forced={'action': 'unencrypt'}) @registerCommand(MODE, 'toggleencrypt', forced={'action': 'toggleencrypt'}, arguments=[ - (['keyids'], {'nargs': argparse.REMAINDER, + (['keyids'], {'nargs': argparse.REMAINDER, 'help':'keyid of the key to encrypt with'})]) @registerCommand(MODE, 'rmencrypt', forced={'action': 'rmencrypt'}, arguments=[ - (['keyids'], {'nargs': argparse.REMAINDER, + (['keyids'], {'nargs': argparse.REMAINDER, 'help':'keyid of the key to encrypt with'})]) class EncryptCommand(Command): def __init__(self, action=None, keyids=None, **kwargs): @@ -507,7 +507,7 @@ class EncryptCommand(Command): recipient = match.group(0) self.encrypt_keys.append(recipient) - logging.debug("encryption keys: " + str(self.encrypt_keys)) + logging.debug("encryption keys: " + str(self.encrypt_keys)) try: # cache all keys before appending to envelope, since otherwise # we get an error message but all earlier keys are added, but @@ -516,12 +516,12 @@ class EncryptCommand(Command): for keyid in self.encrypt_keys: tmp_key = crypto.get_key(keyid) keys[crypto.hash_key(tmp_key)] = tmp_key - + envelope.encrypt_keys.update(keys) except gpgme.GpgmeError as e: if e.code == gpgme.ERR_INV_VALUE or e.code == gpgme.ERR_EOF: raise GPGProblem("Can not find key to encrypt.") raise GPGProblem(str(e)) - + #reload buffer ui.current_buffer.rebuild() diff --git a/alot/crypto.py b/alot/crypto.py index 0b00564f..55b9e30c 100644 --- a/alot/crypto.py +++ b/alot/crypto.py @@ -66,7 +66,7 @@ def _hash_algo_name(hash_algo): return mapping[hash_algo] else: raise GPGProblem(("Invalid hash_algo passed to hash_algo_name." - " Please report this as a bug in alot.")) + " Please report this as a bug in alot.")) def RFC3156_micalg_from_algo(hash_algo): @@ -124,7 +124,7 @@ def get_key(keyid): # Deferred import to avoid a circular import dependency from alot.db.errors import GPGProblem raise GPGProblem(("More than one key found matching this filter." - " Please be more specific (use a key ID like 4AC8EE1D).")) + " Please be more specific (use a key ID like 4AC8EE1D).")) else: raise e return key @@ -132,7 +132,7 @@ def get_key(keyid): def list_keys(private=False): """ - Returns a list of all keys containing keyid. + Returns a list of all keys containing keyid. :param keyid: The part we search for :param private: Whether secret keys are listed @@ -184,9 +184,10 @@ def encrypt(plaintext_str, keys=None): encrypted = encrypted_data.read() return encrypted + def hash_key(key): """ - Returns a hash of the given key. This is a workaround for + Returns a hash of the given key. This is a workaround for https://bugs.launchpad.net/pygpgme/+bug/1089865 and can be removed if the missing feature is added to pygpgme diff --git a/alot/db/envelope.py b/alot/db/envelope.py index 2b35c0b6..2e8f0366 100644 --- a/alot/db/envelope.py +++ b/alot/db/envelope.py @@ -212,7 +212,6 @@ class Envelope(object): plaintext = crypto.email_as_string(unencrypted_msg) logging.debug('encrypting plaintext: ' + plaintext) - try: encrypted_str = crypto.encrypt(plaintext, self.encrypt_keys.values()) -- cgit v1.2.3