summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Totzke <patricktotzke@gmail.com>2015-12-16 16:49:39 +0000
committerPatrick Totzke <patricktotzke@gmail.com>2015-12-16 16:49:39 +0000
commita82ae2019b9cf13968c2189d6ac99270f2d639fd (patch)
treed184e86e9b6f74d178f526d6b184017d186999cf
parent539c5e7d46d2492a89a1b4f93a6e3b5e08a47db7 (diff)
pep8 fixes
-rw-r--r--alot/commands/globals.py9
-rw-r--r--alot/commands/thread.py12
-rw-r--r--alot/db/attachment.py3
-rw-r--r--alot/db/envelope.py8
-rw-r--r--alot/db/message.py5
-rw-r--r--alot/db/thread.py5
-rw-r--r--alot/db/utils.py5
-rw-r--r--alot/ui.py5
8 files changed, 24 insertions, 28 deletions
diff --git a/alot/commands/globals.py b/alot/commands/globals.py
index 26be98fb..f16647bf 100644
--- a/alot/commands/globals.py
+++ b/alot/commands/globals.py
@@ -266,11 +266,6 @@ class ExternalCommand(Command):
afterwards(ret)
-#@registerCommand(MODE, 'edit', arguments=[
-# (['--nospawn'], {'action': 'store_true', 'help':'spawn '}), #todo
-# (['path'], {'help':'file to edit'})]
-#]
-#)
class EditCommand(ExternalCommand):
"""edit a file"""
@@ -752,7 +747,7 @@ class ComposeCommand(Command):
self.envelope.add('Bcc', ','.join(self.bcc))
# get missing From header
- if not 'From' in self.envelope.headers:
+ if 'From' not in self.envelope.headers:
accounts = settings.get_accounts()
if len(accounts) == 1:
a = accounts[0]
@@ -824,7 +819,7 @@ class ComposeCommand(Command):
self.envelope.add('To', to.strip(' \t\n,'))
if settings.get('ask_subject') and \
- not 'Subject' in self.envelope.headers:
+ 'Subject' not in self.envelope.headers:
subject = yield ui.prompt('Subject')
logging.debug('SUBJECT: "%s"' % subject)
if subject is None:
diff --git a/alot/commands/thread.py b/alot/commands/thread.py
index 6349fe2b..ec476326 100644
--- a/alot/commands/thread.py
+++ b/alot/commands/thread.py
@@ -114,13 +114,15 @@ class ReplyCommand(Command):
"""reply to message"""
repeatable = True
- def __init__(self, message=None, all=False, listreply=None, spawn=None, **kwargs):
+ def __init__(self, message=None, all=False, listreply=None, spawn=None,
+ **kwargs):
"""
:param message: message to reply to (defaults to selected message)
:type message: `alot.db.message.Message`
:param all: group reply; copies recipients from Bcc/Cc/To to the reply
:type all: bool
- :param listreply: reply to list; autodetect if unset and enabled in config
+ :param listreply: reply to list; autodetect if unset and enabled in
+ config
:type listreply: bool
:param spawn: force spawning of editor in a new terminal
:type spawn: bool
@@ -169,12 +171,12 @@ class ReplyCommand(Command):
# Auto-detect ML
auto_replyto_mailinglist = settings.get('auto_replyto_mailinglist')
- if mail['List-Id'] and self.listreply == None:
+ if mail['List-Id'] and self.listreply is None:
# mail['List-Id'] is need to enable reply-to-list
self.listreply = auto_replyto_mailinglist
- elif mail['List-Id'] and self.listreply == True:
+ elif mail['List-Id'] and self.listreply is True:
self.listreply = True
- elif self.listreply == False:
+ elif self.listreply is False:
# In this case we only need the sender
self.listreply = False
diff --git a/alot/db/attachment.py b/alot/db/attachment.py
index 5c958e0b..85358037 100644
--- a/alot/db/attachment.py
+++ b/alot/db/attachment.py
@@ -6,12 +6,13 @@ import tempfile
import email.charset as charset
from email.header import Header
from copy import deepcopy
-charset.add_charset('utf-8', charset.QP, charset.QP, 'utf-8')
import alot.helper as helper
from alot.helper import string_decode
from alot.db.utils import decode_header
+charset.add_charset('utf-8', charset.QP, charset.QP, 'utf-8')
+
class Attachment(object):
diff --git a/alot/db/envelope.py b/alot/db/envelope.py
index 6550baeb..4abbdf7a 100644
--- a/alot/db/envelope.py
+++ b/alot/db/envelope.py
@@ -5,8 +5,6 @@ import os
import email
import re
import glob
-import email.charset as charset
-charset.add_charset('utf-8', charset.QP, charset.QP, 'utf-8')
from email.encoders import encode_7or8bit
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
@@ -23,6 +21,9 @@ from alot.errors import GPGProblem, GPGCode
from .attachment import Attachment
from .utils import encode_header
+import email.charset as charset
+charset.add_charset('utf-8', charset.QP, charset.QP, 'utf-8')
+
class Envelope(object):
@@ -210,8 +211,7 @@ class Envelope(object):
micalg = crypto.RFC3156_micalg_from_algo(signatures[0].hash_algo)
unencrypted_msg = MIMEMultipart('signed', micalg=micalg,
- protocol=
- 'application/pgp-signature')
+ protocol='application/pgp-signature')
# wrap signature in MIMEcontainter
stype = 'pgp-signature; name="signature.asc"'
diff --git a/alot/db/message.py b/alot/db/message.py
index 4249f8c8..c94d355b 100644
--- a/alot/db/message.py
+++ b/alot/db/message.py
@@ -3,8 +3,6 @@
# For further details see the COPYING file
import email
from datetime import datetime
-import email.charset as charset
-charset.add_charset('utf-8', charset.QP, charset.QP, 'utf-8')
from notmuch import NullPointerError
import alot.helper as helper
@@ -14,6 +12,9 @@ from .utils import extract_headers, extract_body, message_from_file
from alot.db.utils import decode_header
from .attachment import Attachment
+import email.charset as charset
+charset.add_charset('utf-8', charset.QP, charset.QP, 'utf-8')
+
class Message(object):
diff --git a/alot/db/thread.py b/alot/db/thread.py
index a0df09f1..8bb94a10 100644
--- a/alot/db/thread.py
+++ b/alot/db/thread.py
@@ -39,7 +39,8 @@ class Thread(object):
subject = thread.get_subject()
elif subject_type == 'oldest':
try:
- subject = list(thread.get_toplevel_messages())[0].get_header('subject')
+ first_msg = list(thread.get_toplevel_messages())[0]
+ subject = first_msg.get_header('subject')
except IndexError:
subject = ''
self._subject = subject
@@ -186,7 +187,7 @@ class Thread(object):
aname = settings.get('thread_authors_me')
if not aname:
aname = aaddress
- if not aname in authorslist:
+ if aname not in authorslist:
authorslist.append(aname)
return ', '.join(authorslist)
else:
diff --git a/alot/db/utils.py b/alot/db/utils.py
index 5250577c..63bd6b89 100644
--- a/alot/db/utils.py
+++ b/alot/db/utils.py
@@ -6,8 +6,6 @@ import email
import tempfile
import re
from email.header import Header
-import email.charset as charset
-charset.add_charset('utf-8', charset.QP, charset.QP, 'utf-8')
from email.iterators import typed_subpart_iterator
import logging
import mailcap
@@ -22,6 +20,9 @@ from alot.helper import string_decode
from alot.helper import parse_mailcap_nametemplate
from alot.helper import split_commandstring
+import email.charset as charset
+charset.add_charset('utf-8', charset.QP, charset.QP, 'utf-8')
+
X_SIGNATURE_VALID_HEADER = 'X-Alot-OpenPGP-Signature-Valid'
X_SIGNATURE_MESSAGE_HEADER = 'X-Alot-OpenPGP-Signature-Message'
diff --git a/alot/ui.py b/alot/ui.py
index e9624e54..d81bf0ea 100644
--- a/alot/ui.py
+++ b/alot/ui.py
@@ -187,13 +187,8 @@ class UI(object):
def apply_this_command(ignored, cmdstring):
logging.debug('%s command string: "%s"' % (self.mode,
str(cmdstring)))
- #logging.debug('CMDSEQ: apply %s' % str(cmdstring))
# translate cmdstring into :class:`Command`
- #try:
cmd = commandfactory(cmdstring, self.mode)
- #except CommandParseError, e:
- # self.notify(e.message, priority='error')
- # return
# store cmdline for use with 'repeat' command
if cmd.repeatable:
self.last_commandline = cmdline