python: pep8 compliance for thread.py

This commit is contained in:
pazz 2011-07-12 21:22:13 +01:00 committed by Sebastian Spaeth
parent be7947f459
commit 61b96f2c24

View file

@ -23,7 +23,7 @@ from notmuch.message import Messages
from notmuch.tag import Tags
from datetime import date
#------------------------------------------------------------------------------
class Threads(object):
"""Represents a list of notmuch threads
@ -113,7 +113,7 @@ class Threads(object):
self._threads = None
raise StopIteration
thread = Thread(Threads._get (self._threads), self)
thread = Thread(Threads._get(self._threads), self)
nmlib.notmuch_threads_move_to_next(self._threads)
return thread
@ -132,7 +132,7 @@ class Threads(object):
if self._threads is None:
raise NotmuchError(STATUS.NOT_INITIALIZED)
i=0
i = 0
# returns 'bool'. On out-of-memory it returns None
while nmlib.notmuch_threads_valid(self._threads):
nmlib.notmuch_threads_move_to_next(self._threads)
@ -158,9 +158,9 @@ class Threads(object):
def __del__(self):
"""Close and free the notmuch Threads"""
if self._threads is not None:
nmlib.notmuch_messages_destroy (self._threads)
nmlib.notmuch_messages_destroy(self._threads)
#------------------------------------------------------------------------------
class Thread(object):
"""Represents a single message thread."""
@ -238,7 +238,6 @@ class Thread(object):
raise NotmuchError(STATUS.NOT_INITIALIZED)
return nmlib.notmuch_thread_get_total_messages(self._thread)
def get_toplevel_messages(self):
"""Returns a :class:`Messages` iterator for the top-level messages in
'thread'
@ -266,7 +265,7 @@ class Thread(object):
if msgs_p is None:
NotmuchError(STATUS.NULL_POINTER)
return Messages(msgs_p,self)
return Messages(msgs_p, self)
def get_matched_messages(self):
"""Returns the number of messages in 'thread' that matched the query
@ -374,9 +373,15 @@ class Thread(object):
thread['subject'] = self.get_subject()
thread['tags'] = self.get_tags()
return "thread:%(id)s %(date)12s [%(matched)d/%(total)d] %(authors)s; %(subject)s (%(tags)s)" % (thread)
return "thread:%s %12s [%d/%d] %s; %s (%s)" % (thread['id'],
thread['date'],
thread['matched'],
thread['total'],
thread['authors'],
thread['subject'],
thread['tags'])
def __del__(self):
"""Close and free the notmuch Thread"""
if self._thread is not None:
nmlib.notmuch_thread_destroy (self._thread)
nmlib.notmuch_thread_destroy(self._thread)