summaryrefslogtreecommitdiff
path: root/alot/completion
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2021-01-16 17:58:49 +0100
committerAnton Khirnov <anton@khirnov.net>2021-01-16 17:58:49 +0100
commite420c1c60df5ca21a136a3e383e116ef5edcfd9e (patch)
treeff12e0d49799dfbd40290a0547992a6f4924d574 /alot/completion
parent3fb4d66b584beb3fc91fc22708cd83b125b567d9 (diff)
completion/query: add class attribute prototypes
Also, remove unused dbman attribute and add _ prefix to private attribute keywords.
Diffstat (limited to 'alot/completion')
-rw-r--r--alot/completion/query.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/alot/completion/query.py b/alot/completion/query.py
index 42ea64a0..93d20527 100644
--- a/alot/completion/query.py
+++ b/alot/completion/query.py
@@ -13,17 +13,22 @@ from .namedquery import NamedQueryCompleter
class QueryCompleter(Completer):
"""completion for a notmuch query string"""
+
+ _abookscompleter = None
+ _tagcompleter = None
+ _nquerycompleter = None
+ _keywords = None
+
def __init__(self, dbman):
"""
:param dbman: used to look up available tagstrings
:type dbman: :class:`~alot.db.DBManager`
"""
- self.dbman = dbman
abooks = settings.get_addressbooks()
self._abookscompleter = AbooksCompleter(abooks, addressesonly=True)
self._tagcompleter = TagCompleter(dbman)
self._nquerycompleter = NamedQueryCompleter(dbman)
- self.keywords = ['tag', 'from', 'to', 'subject', 'attachment',
+ self._keywords = ['tag', 'from', 'to', 'subject', 'attachment',
'is', 'id', 'thread', 'folder', 'query']
def complete(self, original, pos):
@@ -49,7 +54,7 @@ class QueryCompleter(Completer):
resultlist.append((newtext, newpos))
return resultlist
else:
- matched = (t for t in self.keywords if t.startswith(myprefix))
+ matched = (t for t in self._keywords if t.startswith(myprefix))
resultlist = []
for keyword in matched:
newprefix = original[:start] + keyword + ':'