Implement utils.irc.IRCArgs.__len__

This commit is contained in:
jesopo 2018-11-04 17:06:50 +00:00
parent b8e3cdb075
commit 1610cfb499

View file

@ -55,13 +55,18 @@ def seperate_hostmask(hostmask: str) -> IRCHostmask:
class IRCArgs(object): class IRCArgs(object):
def __init__(self, args: typing.List[str]): def __init__(self, args: typing.List[str]):
self._args = args self._args = args
def __getitem__(self, index) -> str:
return self._args[index]
def get(self, index: int) -> typing.Optional[str]: def get(self, index: int) -> typing.Optional[str]:
if len(self._args) > index: if len(self._args) > index:
return self._args[index] return self._args[index]
return None return None
def __len__(self) -> int:
return len(self._args)
def __getitem__(self, index) -> str:
return self._args[index]
class IRCLine(object): class IRCLine(object):
def __init__(self, tags: dict, prefix: typing.Optional[str], command: str, def __init__(self, tags: dict, prefix: typing.Optional[str], command: str,
args: IRCArgs): args: IRCArgs):