Remove _name and _draft_name (unused) and add Capability.copy()

This commit is contained in:
jesopo 2019-05-19 11:00:58 +01:00
parent e4bc57b3cc
commit 58d6b16744

View file

@ -279,8 +279,6 @@ class IRCSendBatch(IRCBatch):
class Capability(object):
def __init__(self, name, draft_name=None):
self._caps = set([name, draft_name])
self._name = name
self._draft_name = draft_name
self._on_ack_callbacks = []
def available(self, capabilities: typing.List[str]) -> str:
match = list(set(capabilities)&self._caps)
@ -288,6 +286,9 @@ class Capability(object):
def enabled(self, capability: str) -> bool:
return capability in self._caps
def copy(self):
return Capability(*self._caps)
def on_ack(self, callback: typing.Callable[[], None]):
self._on_ack_callbacks.append(callback)
def ack(self):