summaryrefslogtreecommitdiff
path: root/alot/db
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2020-02-06 11:26:08 +0100
committerAnton Khirnov <anton@khirnov.net>2020-02-06 11:31:27 +0100
commit0a5a9bd056cc6946ed6c75a43dd7a77c404de3d1 (patch)
treed437d77600f43cb0e7fb6a2116577b4767a14a3d /alot/db
parentf6a67c33c360b10cd1c7d876c741846028e35f47 (diff)
db/thread: drop useless getter functions
Diffstat (limited to 'alot/db')
-rw-r--r--alot/db/thread.py43
1 files changed, 20 insertions, 23 deletions
diff --git a/alot/db/thread.py b/alot/db/thread.py
index 1dd78622..9284d076 100644
--- a/alot/db/thread.py
+++ b/alot/db/thread.py
@@ -15,6 +15,21 @@ class Thread:
directly provide contained messages as :class:`~alot.db.message.Message`.
"""
+ """
+ date header of oldest message in this thread as
+ :class:`~datetime.datetime`
+ """
+ oldest_date = None
+
+ """
+ date header of newest message in this thread as
+ :class:`~datetime.datetime`
+ """
+ newest_date = None
+
+ """number of contained messages"""
+ total_messages = None
+
def __init__(self, dbman, thread):
"""
:param dbman: db manager that is used for further lookups
@@ -35,7 +50,7 @@ class Thread:
if not thread:
thread = self._dbman._get_notmuch_thread(self._id)
- self._total_messages = thread.get_total_messages()
+ self.total_messages = thread.get_total_messages()
self._notmuch_authors_string = thread.get_authors()
subject_type = settings.get('thread_subject')
@@ -53,14 +68,14 @@ class Thread:
ts = thread.get_oldest_date()
try:
- self._oldest_date = datetime.fromtimestamp(ts)
+ self.oldest_date = datetime.fromtimestamp(ts)
except ValueError: # year is out of range
- self._oldest_date = None
+ self.oldest_date = None
try:
timestamp = thread.get_newest_date()
- self._newest_date = datetime.fromtimestamp(timestamp)
+ self.newest_date = datetime.fromtimestamp(timestamp)
except ValueError: # year is out of range
- self._newest_date = None
+ self.newest_date = None
self._tags = {t for t in thread.get_tags()}
self._messages = {} # this maps messages to its children
@@ -262,24 +277,6 @@ class Thread:
return msg_hash[m]
return None
- def get_newest_date(self):
- """
- returns date header of newest message in this thread as
- :class:`~datetime.datetime`
- """
- return self._newest_date
-
- def get_oldest_date(self):
- """
- returns date header of oldest message in this thread as
- :class:`~datetime.datetime`
- """
- return self._oldest_date
-
- def get_total_messages(self):
- """returns number of contained messages"""
- return self._total_messages
-
def matches(self, query):
"""
Check if this thread matches the given notmuch query.