From f9b1260a6c4dec2c3b4291c7a206e04ec6b691bd Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Thu, 21 Jan 2021 09:53:40 +0100 Subject: Use super() where applicable. --- alot/completion/abooks.py | 2 ++ alot/completion/accounts.py | 3 +-- alot/completion/argparse.py | 2 ++ alot/completion/command.py | 2 ++ alot/completion/commandline.py | 2 ++ alot/completion/commandname.py | 2 ++ alot/completion/contacts.py | 2 ++ alot/completion/cryptokey.py | 2 +- alot/completion/multipleselection.py | 2 ++ alot/completion/namedquery.py | 2 +- alot/completion/query.py | 2 ++ alot/completion/stringlist.py | 2 ++ alot/completion/tag.py | 2 +- alot/completion/tags.py | 2 ++ 14 files changed, 24 insertions(+), 5 deletions(-) (limited to 'alot/completion') diff --git a/alot/completion/abooks.py b/alot/completion/abooks.py index c5bfe3e8..bc5584e8 100644 --- a/alot/completion/abooks.py +++ b/alot/completion/abooks.py @@ -22,6 +22,8 @@ class AbooksCompleter(Completer): self.abooks = abooks self.addressesonly = addressesonly + super().__init__() + def complete(self, original, pos): if not self.abooks: return [] diff --git a/alot/completion/accounts.py b/alot/completion/accounts.py index 3250a7c9..8bfd7e8d 100644 --- a/alot/completion/accounts.py +++ b/alot/completion/accounts.py @@ -14,5 +14,4 @@ class AccountCompleter(StringlistCompleter): accounts = settings.get_accounts() resultlist = [formataddr((a.realname, str(a.address))) for a in accounts] - StringlistCompleter.__init__(self, resultlist, match_anywhere=True, - **kwargs) + super().__init__(resultlist, match_anywhere = True, **kwargs) diff --git a/alot/completion/argparse.py b/alot/completion/argparse.py index ac15b2c6..6a480e7e 100644 --- a/alot/completion/argparse.py +++ b/alot/completion/argparse.py @@ -17,6 +17,8 @@ class ArgparseOptionCompleter(Completer): self.parser = parser self.actions = parser._optionals._actions + super().__init__() + def complete(self, original, pos): pref = original[:pos] diff --git a/alot/completion/command.py b/alot/completion/command.py index a320bf93..72c82ea3 100644 --- a/alot/completion/command.py +++ b/alot/completion/command.py @@ -40,6 +40,8 @@ class CommandCompleter(Completer): self.currentbuffer = currentbuffer self._commandnamecompleter = CommandNameCompleter(mode) + super().__init__() + @cached_property def _querycompleter(self): return QueryCompleter(self.dbman) diff --git a/alot/completion/commandline.py b/alot/completion/commandline.py index 0092c8e7..866ed66f 100644 --- a/alot/completion/commandline.py +++ b/alot/completion/commandline.py @@ -23,6 +23,8 @@ class CommandLineCompleter(Completer): """ self._commandcompleter = CommandCompleter(dbman, mode, currentbuffer) + super().__init__() + @staticmethod def get_context(line, pos): """ diff --git a/alot/completion/commandname.py b/alot/completion/commandname.py index 5c946eb6..6f71459b 100644 --- a/alot/completion/commandname.py +++ b/alot/completion/commandname.py @@ -17,6 +17,8 @@ class CommandNameCompleter(Completer): """ self.mode = mode + super().__init__() + def complete(self, original, pos): commandprefix = original[:pos] logging.debug('original="%s" prefix="%s"', original, commandprefix) diff --git a/alot/completion/contacts.py b/alot/completion/contacts.py index ae4e71cd..55304081 100644 --- a/alot/completion/contacts.py +++ b/alot/completion/contacts.py @@ -19,3 +19,5 @@ class ContactsCompleter(MultipleSelectionCompleter): """ self._completer = AbooksCompleter(abooks, addressesonly=addressesonly) self._separator = ', ' + + super().__init__() diff --git a/alot/completion/cryptokey.py b/alot/completion/cryptokey.py index 0631eee3..0ab2ed29 100644 --- a/alot/completion/cryptokey.py +++ b/alot/completion/cryptokey.py @@ -21,4 +21,4 @@ class CryptoKeyCompleter(StringlistCompleter): resultlist.append(s.keyid) for u in k.uids: resultlist.append(u.email) - StringlistCompleter.__init__(self, resultlist, match_anywhere=True) + super().__init__(resultlist, match_anywhere = True) diff --git a/alot/completion/multipleselection.py b/alot/completion/multipleselection.py index 45de5a28..28b7d38d 100644 --- a/alot/completion/multipleselection.py +++ b/alot/completion/multipleselection.py @@ -25,6 +25,8 @@ class MultipleSelectionCompleter(Completer): self._completer = completer self._separator = separator + super().__init__() + def relevant_part(self, original, pos): """Calculate the subword of `original` that `pos` is in.""" start = original.rfind(self._separator, 0, pos) diff --git a/alot/completion/namedquery.py b/alot/completion/namedquery.py index bcad5d2c..e166541b 100644 --- a/alot/completion/namedquery.py +++ b/alot/completion/namedquery.py @@ -15,4 +15,4 @@ class NamedQueryCompleter(StringlistCompleter): """ # mapping of alias to query string (dict str -> str) nqueries = dbman.get_named_queries() - StringlistCompleter.__init__(self, list(nqueries)) + super().__init__(list(nqueries)) diff --git a/alot/completion/query.py b/alot/completion/query.py index d073fde3..88bf3ae4 100644 --- a/alot/completion/query.py +++ b/alot/completion/query.py @@ -34,6 +34,8 @@ class QueryCompleter(Completer): self._tagcompleter = TagCompleter(dbman) self._nquerycompleter = NamedQueryCompleter(dbman) + super().__init__() + def complete(self, original, pos): mypart, start, end, mypos = self.relevant_part(original, pos) myprefix = mypart[:mypos] diff --git a/alot/completion/stringlist.py b/alot/completion/stringlist.py index 9d7fa3d3..c69a385f 100644 --- a/alot/completion/stringlist.py +++ b/alot/completion/stringlist.py @@ -20,6 +20,8 @@ class StringlistCompleter(Completer): self.flags = re.IGNORECASE if ignorecase else 0 self.match_anywhere = match_anywhere + super().__init__() + def complete(self, original, pos): pref = original[:pos] diff --git a/alot/completion/tag.py b/alot/completion/tag.py index fd6ed119..7b876841 100644 --- a/alot/completion/tag.py +++ b/alot/completion/tag.py @@ -14,4 +14,4 @@ class TagCompleter(StringlistCompleter): :type dbman: :class:`~alot.db.DBManager` """ resultlist = dbman.get_all_tags() - StringlistCompleter.__init__(self, resultlist) + super().__init__(resultlist) diff --git a/alot/completion/tags.py b/alot/completion/tags.py index b151e6f5..38b0a0cd 100644 --- a/alot/completion/tags.py +++ b/alot/completion/tags.py @@ -16,3 +16,5 @@ class TagsCompleter(MultipleSelectionCompleter): """ self._completer = TagCompleter(dbman) self._separator = ',' + + super().__init__() -- cgit v1.2.3