From 0dd720a648cd535037537973210ead00cb972110 Mon Sep 17 00:00:00 2001 From: Patrick Totzke Date: Wed, 5 Sep 2012 21:58:12 +0100 Subject: doc: docstrings --- alot/helper.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'alot/helper.py') diff --git a/alot/helper.py b/alot/helper.py index a8327145..973443b0 100644 --- a/alot/helper.py +++ b/alot/helper.py @@ -55,7 +55,7 @@ def split_commandstring(cmdstring): def safely_get(clb, E, on_error=''): """ returns result of :func:`clb` and falls back to `on_error` - in case `E` is raised. + in case exception `E` is raised. :param clb: function to evaluate :type clb: callable @@ -112,8 +112,9 @@ def string_sanitize(string, tab_width=8): def string_decode(string, enc='ascii'): - """safely decodes string to unicode bytestring, - respecting `enc` as a hint""" + """ + safely decodes string to unicode bytestring, respecting `enc` as a hint. + """ if enc is None: enc = 'ascii' @@ -127,6 +128,7 @@ def string_decode(string, enc='ascii'): def shorten(string, maxlen): + """shortens string if longer than maxlen, appending ellipsis""" if maxlen > 1 and len(string) > maxlen: string = string[:maxlen - 1] + u'\u2026' return string[:maxlen] @@ -145,17 +147,14 @@ def shorten_author_string(authors_string, maxlength): - First author is always shown (if too long is shorten with ellipsis) - - If possible, last author is also shown (if too long, uses - ellipsis) + - If possible, last author is also shown (if too long, uses ellipsis) - If there are more than 2 authors in the thread, show the - maximum of them. More recent senders have more priority (Is - the list of authors already sorted by the date of msgs????) + maximum of them. More recent senders have higher priority. - If it is finally necessary to hide any author, an ellipsis between first and next authors is added. - >>> authors = u'King Kong, Mucho Muchacho, Jaime Huerta, Flash Gordon' >>> print shorten_author_string(authors, 60) King Kong, Mucho Muchacho, Jaime Huerta, Flash Gordon -- cgit v1.2.3