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.
This commit is contained in:
Ryan Roden-Corrent 2016-06-04 07:29:56 -04:00
parent 1dc20f4d02
commit 9f660a98f2

View File

@ -154,7 +154,7 @@ class KeyConfigParser(QObject):
@cmdutils.argument('win_id', win_id=True) @cmdutils.argument('win_id', win_id=True)
@cmdutils.argument('key', completion=usertypes.Completion.empty) @cmdutils.argument('key', completion=usertypes.Completion.empty)
@cmdutils.argument('command', completion=usertypes.Completion.command) @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. """Bind a key to a command.
Args: Args:
@ -169,9 +169,6 @@ class KeyConfigParser(QObject):
# <Ctrl-t>, <ctrl-T>, and <ctrl-t> should be considered equivalent # <Ctrl-t>, <ctrl-T>, and <ctrl-t> should be considered equivalent
key = key.lower() key = key.lower()
if mode is None:
mode = 'normal'
if command is None: if command is None:
cmd = self.get_bindings_for(mode).get(key, None) cmd = self.get_bindings_for(mode).get(key, None)
if cmd is None: if cmd is None:
@ -202,7 +199,7 @@ class KeyConfigParser(QObject):
self._mark_config_dirty() self._mark_config_dirty()
@cmdutils.register(instance='key-config') @cmdutils.register(instance='key-config')
def unbind(self, key, mode=None): def unbind(self, key, mode='normal'):
"""Unbind a keychain. """Unbind a keychain.
Args: Args:
@ -214,8 +211,6 @@ class KeyConfigParser(QObject):
# <Ctrl-t>, <ctrl-T>, and <ctrl-t> should be considered equivalent # <Ctrl-t>, <ctrl-T>, and <ctrl-t> should be considered equivalent
key = key.lower() key = key.lower()
if mode is None:
mode = 'normal'
mode = self._normalize_sectname(mode) mode = self._normalize_sectname(mode)
for m in mode.split(','): for m in mode.split(','):
if m not in configdata.KEY_DATA: if m not in configdata.KEY_DATA: