Remove _name and _draft_name (unused) and add Capability.copy()
This commit is contained in:
parent
e4bc57b3cc
commit
58d6b16744
1 changed files with 3 additions and 2 deletions
|
@ -279,8 +279,6 @@ class IRCSendBatch(IRCBatch):
|
||||||
class Capability(object):
|
class Capability(object):
|
||||||
def __init__(self, name, draft_name=None):
|
def __init__(self, name, draft_name=None):
|
||||||
self._caps = set([name, draft_name])
|
self._caps = set([name, draft_name])
|
||||||
self._name = name
|
|
||||||
self._draft_name = draft_name
|
|
||||||
self._on_ack_callbacks = []
|
self._on_ack_callbacks = []
|
||||||
def available(self, capabilities: typing.List[str]) -> str:
|
def available(self, capabilities: typing.List[str]) -> str:
|
||||||
match = list(set(capabilities)&self._caps)
|
match = list(set(capabilities)&self._caps)
|
||||||
|
@ -288,6 +286,9 @@ class Capability(object):
|
||||||
def enabled(self, capability: str) -> bool:
|
def enabled(self, capability: str) -> bool:
|
||||||
return capability in self._caps
|
return capability in self._caps
|
||||||
|
|
||||||
|
def copy(self):
|
||||||
|
return Capability(*self._caps)
|
||||||
|
|
||||||
def on_ack(self, callback: typing.Callable[[], None]):
|
def on_ack(self, callback: typing.Callable[[], None]):
|
||||||
self._on_ack_callbacks.append(callback)
|
self._on_ack_callbacks.append(callback)
|
||||||
def ack(self):
|
def ack(self):
|
||||||
|
|
Loading…
Reference in a new issue