From 9f660a98f265d1bc24839eb9c146ae7e10cb3c84 Mon Sep 17 00:00:00 2001 From: Ryan Roden-Corrent Date: Sat, 4 Jun 2016 07:29:56 -0400 Subject: [PATCH] Default mode='normal' for bind/unbind. Both set mode=None, then later checked if mode == 'None' and set it to 'normal'. This reduces the function complexity just enough that pylint will stop complaining. --- qutebrowser/config/parsers/keyconf.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/qutebrowser/config/parsers/keyconf.py b/qutebrowser/config/parsers/keyconf.py index 8841bea73..7c00b9584 100644 --- a/qutebrowser/config/parsers/keyconf.py +++ b/qutebrowser/config/parsers/keyconf.py @@ -154,7 +154,7 @@ class KeyConfigParser(QObject): @cmdutils.argument('win_id', win_id=True) @cmdutils.argument('key', completion=usertypes.Completion.empty) @cmdutils.argument('command', completion=usertypes.Completion.command) - def bind(self, key, win_id, command=None, *, mode=None, force=False): + def bind(self, key, win_id, command=None, *, mode='normal', force=False): """Bind a key to a command. Args: @@ -169,9 +169,6 @@ class KeyConfigParser(QObject): # , , and should be considered equivalent key = key.lower() - if mode is None: - mode = 'normal' - if command is None: cmd = self.get_bindings_for(mode).get(key, None) if cmd is None: @@ -202,7 +199,7 @@ class KeyConfigParser(QObject): self._mark_config_dirty() @cmdutils.register(instance='key-config') - def unbind(self, key, mode=None): + def unbind(self, key, mode='normal'): """Unbind a keychain. Args: @@ -214,8 +211,6 @@ class KeyConfigParser(QObject): # , , and should be considered equivalent key = key.lower() - if mode is None: - mode = 'normal' mode = self._normalize_sectname(mode) for m in mode.split(','): if m not in configdata.KEY_DATA: