diff --git a/src/IRCServer.py b/src/IRCServer.py index 1d5357ec..e6c08ee6 100644 --- a/src/IRCServer.py +++ b/src/IRCServer.py @@ -288,7 +288,8 @@ class Server(IRCObject.Object): return bool(self.available_capability(capability)) def has_capability_str(self, capability: str) -> bool: return capability in self.agreed_capabilities - def available_capability(self, capability: utils.irc.Capability) -> str: + def available_capability(self, capability: utils.irc.Capability + ) -> typing.Optional[str]: return capability.available(self.agreed_capabilities) def waiting_for_capabilities(self) -> bool: diff --git a/src/utils/irc/__init__.py b/src/utils/irc/__init__.py index 67eb6b7e..3e3cef1b 100644 --- a/src/utils/irc/__init__.py +++ b/src/utils/irc/__init__.py @@ -270,10 +270,12 @@ class IRCBatch(object): return self._lines class Capability(object): - def __init__(self, name, draft_name=None): + def __init__(self, name: typing.Optional[str], draft_name: str=None): self._caps = set([name, draft_name]) - self._on_ack_callbacks = [] - def available(self, capabilities: typing.Iterable[str]) -> str: + self._on_ack_callbacks = [ + ] # type: typing.List[typing.Callable[[], None]] + def available(self, capabilities: typing.Iterable[str] + ) -> typing.Optional[str]: match = list(set(capabilities)&self._caps) return match[0] if match else None @@ -289,7 +291,7 @@ class Capability(object): pass class MessageTag(object): - def __init__(self, name: str, draft_name: str=None): + def __init__(self, name: typing.Optional[str], draft_name: str=None): self._names = set([name, draft_name]) def get_value(self, tags: typing.Dict[str, str]) -> typing.Optional[str]: key = list(set(tags.keys())&self._names)