Fixed cmdset.remove() by correcting the __ne__ operator on commands to properly use the matchset to identify disjoint sets.

This commit is contained in:
Griatch 2016-04-04 09:37:46 +02:00
parent 77416953ca
commit e10769ac22
2 changed files with 10 additions and 2 deletions

View file

@ -509,7 +509,14 @@ class CmdSet(with_metaclass(_CmdSetMeta, object)):
"""
cmd = self._instantiate(cmd)
self.commands = [oldcmd for oldcmd in self.commands if oldcmd != cmd]
if cmd.key.startswith("__"):
try:
ic = self.system_commands.index(cmd)
del self.system_commands[ic]
except ValueError:
pass
else:
self.commands = [oldcmd for oldcmd in self.commands if oldcmd != cmd]
def get(self, cmd):
"""

View file

@ -200,7 +200,8 @@ class Command(with_metaclass(CommandMeta, object)):
__eq__.
"""
try:
return not cmd.key in self._matcheset
return self._matchset.isdisjoint(cmd._matchset)
#return not cmd.key in self._matcheset
except AttributeError:
return not cmd in self._matchset