From 1610cfb4992f95997299e0aba69cefa4f069cf2d Mon Sep 17 00:00:00 2001 From: jesopo Date: Sun, 4 Nov 2018 17:06:50 +0000 Subject: [PATCH] Implement utils.irc.IRCArgs.__len__ --- src/utils/irc.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/utils/irc.py b/src/utils/irc.py index 67597149..da9a0747 100644 --- a/src/utils/irc.py +++ b/src/utils/irc.py @@ -55,13 +55,18 @@ def seperate_hostmask(hostmask: str) -> IRCHostmask: class IRCArgs(object): def __init__(self, args: typing.List[str]): self._args = args - def __getitem__(self, index) -> str: - return self._args[index] + def get(self, index: int) -> typing.Optional[str]: if len(self._args) > index: return self._args[index] return None + def __len__(self) -> int: + return len(self._args) + def __getitem__(self, index) -> str: + return self._args[index] + + class IRCLine(object): def __init__(self, tags: dict, prefix: typing.Optional[str], command: str, args: IRCArgs):