diff options
author | Patrick Totzke <patricktotzke@gmail.com> | 2011-12-11 14:47:46 +0000 |
---|---|---|
committer | Patrick Totzke <patricktotzke@gmail.com> | 2011-12-11 14:47:46 +0000 |
commit | a6c0f6adbc8101026e380285dbdf7cf20a23f29e (patch) | |
tree | c3468af2fd36f59ffee0210de855525d74551ddd /alot | |
parent | 4735a8d93e7ce0659cc6b7da49490dd281180592 (diff) |
pep8
Diffstat (limited to 'alot')
-rw-r--r-- | alot/commands/__init__.py | 3 | ||||
-rw-r--r-- | alot/completion.py | 19 | ||||
-rw-r--r-- | alot/settings.py | 15 | ||||
-rw-r--r-- | alot/widgets.py | 6 |
4 files changed, 27 insertions, 16 deletions
diff --git a/alot/commands/__init__.py b/alot/commands/__init__.py index c58d4ade..2fbb8552 100644 --- a/alot/commands/__init__.py +++ b/alot/commands/__init__.py @@ -198,4 +198,5 @@ def commandfactory(cmdline, mode='global'): return cmdclass(**parms) -__all__ = list(filename[:-3] for filename in glob.glob1(os.path.dirname(__file__), '*.py')) +pyfiles = glob.glob1(os.path.dirname(__file__), '*.py') +__all__ = list(filename[:-3] for filename in pyfiles) diff --git a/alot/completion.py b/alot/completion.py index b54b9c91..02dd8904 100644 --- a/alot/completion.py +++ b/alot/completion.py @@ -15,14 +15,17 @@ class Completer(object): :param original: the string to complete :type original: str :param pos: starting position to complete from - :returns: pairs of completed string and cursor position in the new string + :returns: pairs of completed string and cursor position in the + new string :rtype: list of (str, int) """ return list() def relevant_part(self, original, pos, sep=' '): - """calculates the subword in a `sep`-splitted list of substrings of `original` - that `pos` is ia.n""" + """ + calculates the subword in a `sep`-splitted list of substrings of + `original` that `pos` is ia.n + """ start = original.rfind(sep, 0, pos) + 1 end = original.find(sep, pos - 1) if end == -1: @@ -214,10 +217,14 @@ class CommandLineCompleter(Completer): header, params = params.split(' ', 1) localpos = localpos - (len(header) + 1) if header.lower() in ['to', 'cc', 'bcc']: - res = self._contactscompleter.complete(params, - localpos) + # prepend 'set ' + header and correct position - res = [('%s %s' % (header, t), p + len(header) + 1) for (t, p) in res] + def f((completed, pos)): + return ('%s %s' % (header, completed), + pos + len(header) + 1) + res = map(f, self._contactscompleter.complete(params, + localpos)) + logging.debug(res) elif cmd == 'retag': res = self._tagscompleter.complete(params, localpos, diff --git a/alot/settings.py b/alot/settings.py index d43ce245..f40d6938 100644 --- a/alot/settings.py +++ b/alot/settings.py @@ -188,16 +188,17 @@ mailcaps = mailcap.getcaps() def get_mime_handler(mime_type, key='view', interactive=True): """ - get shellcomand defined in the users `mailcap` as handler for files of given - `mime_type`. + get shellcomand defined in the users `mailcap` as handler for files of + given `mime_type`. - :param mime_type: file type as extracted :meth:`email.Message.get_content_type` + :param mime_type: file type :type mime_type: str - :param key: identifies one of possibly many commands for this type by naming - the intended usage, e.g. 'edit' or 'view'. Defaults to 'view'. + :param key: identifies one of possibly many commands for this type by + naming the intended usage, e.g. 'edit' or 'view'. Defaults + to 'view'. :type key: str - :param interactive: choose the "interactive session" handler rather than the - "print to stdout and immediately return" handler + :param interactive: choose the "interactive session" handler rather than + the "print to stdout and immediately return" handler :type interactive: bool """ if interactive: diff --git a/alot/widgets.py b/alot/widgets.py index 3be5aafb..bab2fbcc 100644 --- a/alot/widgets.py +++ b/alot/widgets.py @@ -95,7 +95,8 @@ class ThreadlineWidget(urwid.AttrMap): datestring = newest.strftime(formatstring) else: datestring = pretty_datetime(newest).rjust(10) - self.date_w = urwid.AttrMap(urwid.Text(datestring), 'search_thread_date') + self.date_w = urwid.AttrMap(urwid.Text(datestring), + 'search_thread_date') cols.append(('fixed', len(datestring), self.date_w)) if self.thread: @@ -160,7 +161,8 @@ class ThreadlineWidget(urwid.AttrMap): self.authors_w.set_attr_map({None: 'search_thread_authors_focus'}) self.subject_w.set_attr_map({None: 'search_thread_subject_focus'}) if self.display_content: - self.content_w.set_attr_map({None: 'search_thread_content_focus'}) + self.content_w.set_attr_map( + {None: 'search_thread_content_focus'}) else: self.date_w.set_attr_map({None: 'search_thread_date'}) self.mailcount_w.set_attr_map({None: 'search_thread_mailcount'}) |