summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--alot/buffers.py4
-rw-r--r--alot/commands/__init__.py2
-rw-r--r--alot/commands/envelope.py4
-rw-r--r--alot/commands/globals.py2
-rw-r--r--alot/commands/search.py2
-rw-r--r--alot/commands/thread.py8
-rw-r--r--alot/completion.py7
-rw-r--r--alot/db/envelope.py3
-rw-r--r--alot/db/utils.py2
-rw-r--r--alot/settings/manager.py4
-rw-r--r--alot/ui.py2
11 files changed, 20 insertions, 20 deletions
diff --git a/alot/buffers.py b/alot/buffers.py
index b73b2ecd..e93f9356 100644
--- a/alot/buffers.py
+++ b/alot/buffers.py
@@ -85,7 +85,7 @@ class BufferlistBuffer(Buffer):
self.isinitialized = True
lines = list()
- displayedbuffers = filter(self.filtfun, self.ui.buffers)
+ displayedbuffers = [b for b in self.ui.buffers if self.filtfun(b)]
for (num, b) in enumerate(displayedbuffers):
line = BufferlineWidget(b)
if (num % 2) == 0:
@@ -634,7 +634,7 @@ class TagListBuffer(Buffer):
self.isinitialized = True
lines = list()
- displayedtags = sorted(filter(self.filtfun, self.tags),
+ displayedtags = sorted((t for t in self.tags if self.filtfun(t)),
key=unicode.lower)
for (num, b) in enumerate(displayedtags):
if (num % 2) == 0:
diff --git a/alot/commands/__init__.py b/alot/commands/__init__.py
index 49a096a1..05ce3424 100644
--- a/alot/commands/__init__.py
+++ b/alot/commands/__init__.py
@@ -176,7 +176,7 @@ def commandfactory(cmdline, mode='global'):
args = split_commandstring(cmdline)
except ValueError as e:
raise CommandParseError(e.message)
- args = map(lambda x: string_decode(x, 'utf-8'), args)
+ args = [string_decode(x, 'utf-8') for x in args]
logging.debug('ARGS: %s', args)
cmdname = args[0]
args = args[1:]
diff --git a/alot/commands/envelope.py b/alot/commands/envelope.py
index c9d05b0d..8a202ad3 100644
--- a/alot/commands/envelope.py
+++ b/alot/commands/envelope.py
@@ -48,8 +48,8 @@ class AttachCommand(Command):
envelope = ui.current_buffer.envelope
if self.path: # TODO: not possible, otherwise argparse error before
- files = filter(os.path.isfile,
- glob.glob(os.path.expanduser(self.path)))
+ files = [g for g in glob.glob(os.path.expanduser(self.path))
+ if os.path.isfile(g)]
if not files:
ui.notify('no matches, abort')
return
diff --git a/alot/commands/globals.py b/alot/commands/globals.py
index d2d0285c..2887345f 100644
--- a/alot/commands/globals.py
+++ b/alot/commands/globals.py
@@ -843,7 +843,7 @@ class ComposeCommand(Command):
if settings.get('compose_ask_tags'):
comp = TagsCompleter(ui.dbman)
tagsstring = yield ui.prompt('Tags', completer=comp)
- tags = filter(lambda x: x, tagsstring.split(','))
+ tags = [t for t in tagsstring.splie(',') if t]
if tags is None:
raise CommandCanceled()
diff --git a/alot/commands/search.py b/alot/commands/search.py
index b8ecef6d..63572e68 100644
--- a/alot/commands/search.py
+++ b/alot/commands/search.py
@@ -211,7 +211,7 @@ class TagCommand(Command):
searchbuffer.result_count += (hitcount_after - hitcount_before)
ui.update()
- tags = filter(lambda x: x, self.tagsstring.split(','))
+ tags = [x for x in self.tagsstring.split(',') if x]
try:
if self.action == 'add':
diff --git a/alot/commands/thread.py b/alot/commands/thread.py
index 0c48c174..2aa96cf8 100644
--- a/alot/commands/thread.py
+++ b/alot/commands/thread.py
@@ -73,7 +73,7 @@ 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 = map(re.escape, account.get_addresses())
+ acc_addresses = [re.escape(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:
@@ -551,7 +551,7 @@ class ChangeDisplaymodeCommand(Command):
msg = msgt.get_message()
return msg.matches(self.query)
- messagetrees = filter(matches, messagetrees)
+ messagetrees = [m for m in messagetrees if matches(m)]
for mt in messagetrees:
# determine new display values for this message
@@ -930,7 +930,7 @@ class OpenAttachmentCommand(Command):
handler_raw_commandstring = entry['view']
# read parameter
part = self.attachment.get_mime_representation()
- parms = tuple(map('='.join, part.get_params()))
+ parms = tuple('='.join(p) for p in part.get_params())
# in case the mailcap defined command contains no '%s',
# we pipe the files content to the handling command via stdin
@@ -1100,7 +1100,7 @@ class TagCommand(Command):
tbuffer.refresh()
- tags = filter(lambda x: x, self.tagsstring.split(','))
+ tags = [t for t in self.tagsstring.split(',') if t]
try:
for mt in messagetrees:
m = mt.get_message()
diff --git a/alot/completion.py b/alot/completion.py
index 37861572..2e643e37 100644
--- a/alot/completion.py
+++ b/alot/completion.py
@@ -150,7 +150,7 @@ class QueryCompleter(Completer):
resultlist.append((newtext, newpos))
return resultlist
else:
- matched = filter(lambda t: t.startswith(myprefix), self.keywords)
+ matched = (t for t in self.keywords if t.startswith(myprefix))
resultlist = []
for keyword in matched:
newprefix = original[:start] + keyword + ':'
@@ -412,8 +412,7 @@ class CommandCompleter(Completer):
def f((completed, pos)):
return ('%s %s' % (header, completed),
pos + len(header) + 1)
- res = map(f, res)
- logging.debug(res)
+ logging.debug(f(r) for r in res)
elif self.mode == 'envelope' and cmd == 'unset':
plist = params.split(' ', 1)
@@ -532,7 +531,7 @@ class PathCompleter(Completer):
escaped_path = escape(path)
return escaped_path, len(escaped_path)
- return map(prep, glob.glob(deescape(prefix) + '*'))
+ return [prep(g) for g in glob.glob(deescape(prefix) + '*')]
class CryptoKeyCompleter(StringlistCompleter):
diff --git a/alot/db/envelope.py b/alot/db/envelope.py
index 02a4a212..d45a587d 100644
--- a/alot/db/envelope.py
+++ b/alot/db/envelope.py
@@ -326,7 +326,8 @@ class Envelope(object):
to_attach = []
for line in self.get_all('Attach'):
gpath = os.path.expanduser(line.strip())
- to_attach += filter(os.path.isfile, glob.glob(gpath))
+ to_attach += [g for g in glob.glob(gpath)
+ if os.path.isfile(g)]
logging.debug('Attaching: %s', to_attach)
for path in to_attach:
self.attach(path)
diff --git a/alot/db/utils.py b/alot/db/utils.py
index 71c46931..9ad1f98c 100644
--- a/alot/db/utils.py
+++ b/alot/db/utils.py
@@ -323,7 +323,7 @@ def extract_body(mail, types=None, field_key='copiousoutput'):
stdin = raw_payload
# read parameter, create handler command
- parms = tuple(map('='.join, part.get_params()))
+ parms = tuple('='.join(p) for p in part.get_params())
# create and call external command
cmd = mailcap.subst(entry['view'], ctype,
diff --git a/alot/settings/manager.py b/alot/settings/manager.py
index 392f3535..5718193f 100644
--- a/alot/settings/manager.py
+++ b/alot/settings/manager.py
@@ -318,8 +318,8 @@ class SettingsManager(object):
globalmaps, modemaps = self.get_keybindings(mode)
candidates = globalmaps.keys() + modemaps.keys()
if prefix is not None:
- prefixs = prefix + ' '
- cand = filter(lambda x: x.startswith(prefixs), candidates)
+ prefixes = prefix + ' '
+ cand = [c for c in candidates if c.startswith(prefixes)]
if prefix in candidates:
candidates = cand + [prefix]
else:
diff --git a/alot/ui.py b/alot/ui.py
index 811f2150..a56efe4b 100644
--- a/alot/ui.py
+++ b/alot/ui.py
@@ -446,7 +446,7 @@ class UI(object):
:type t: alot.buffers.Buffer
:rtype: list
"""
- return filter(lambda x: isinstance(x, t), self.buffers)
+ return [x for x in self.buffers if isinstance(x, t)]
def clear_notify(self, messages):
"""