summaryrefslogtreecommitdiff
path: root/qutebrowser/keyinput/basekeyparser.py
diff options
context:
space:
mode:
authorFlorian Bruhin <me@the-compiler.org>2019-09-12 22:44:17 +0200
committerFlorian Bruhin <me@the-compiler.org>2019-09-13 13:12:54 +0200
commit0b3087b613a2eec6ef2fbfb170c38968b29a10de (patch)
tree59e38ff1d6fc91b6c13de961bd5a83a304fa731f /qutebrowser/keyinput/basekeyparser.py
parent09c0bb9d143717238bf395c64409ae94dbe0a2c8 (diff)
downloadqutebrowser-0b3087b613a2eec6ef2fbfb170c38968b29a10de.tar.gz
qutebrowser-0b3087b613a2eec6ef2fbfb170c38968b29a10de.zip
Remove BindingTrie.__getitem__
Diffstat (limited to 'qutebrowser/keyinput/basekeyparser.py')
-rw-r--r--qutebrowser/keyinput/basekeyparser.py14
1 files changed, 4 insertions, 10 deletions
diff --git a/qutebrowser/keyinput/basekeyparser.py b/qutebrowser/keyinput/basekeyparser.py
index 66901ab25..6dd003e18 100644
--- a/qutebrowser/keyinput/basekeyparser.py
+++ b/qutebrowser/keyinput/basekeyparser.py
@@ -58,11 +58,12 @@ class BindingTrie:
bindings at all.
From the outside, this class works similar to a mapping of
- keyutils.KeySequence to str. Operations like __{get,set}attr__ work like
- you'd expect. Additionally, a "matches" method can be used to do partial
- matching.
+ keyutils.KeySequence to str. Doing trie[sequence] = 'command' adds a
+ binding, and so does calling .update() with a mapping. Additionally, a
+ "matches" method can be used to do partial matching.
However, some mapping methods are not (yet) implemented:
+ - __getitem__ (use matches() instead)
- __len__
- __iter__
- __delitem__
@@ -79,13 +80,6 @@ class BindingTrie:
} # type: typing.MutableMapping[keyutils.KeyInfo, BindingTrie]
self.command = None # type: typing.Optional[str]
- def __getitem__(self,
- sequence: keyutils.KeySequence) -> typing.Optional[str]:
- result = self.matches(sequence)
- if result.match_type != QKeySequence.ExactMatch:
- raise KeyError(sequence)
- return result.command
-
def __setitem__(self, sequence: keyutils.KeySequence,
command: str) -> None:
node = self