aboutsummaryrefslogtreecommitdiff
path: root/src/utils/irc/__init__.py
diff options
context:
space:
mode:
authorGravatar jesopo2019-02-19 15:56:35 +0000
committerGravatar jesopo2019-02-19 15:57:00 +0000
commit577fae7ceabfd2a43b798e02a67c518c23ed33bd (patch)
tree27990bb17ca0be017aeaaf9e3a73ef1dffbea6c6 /src/utils/irc/__init__.py
parenttypo, 'utls' -> 'utils' (utils.irc) (diff)
signature
Don't pass `None` around as tag default, fix some missing return type args
Diffstat (limited to 'src/utils/irc/__init__.py')
-rw-r--r--src/utils/irc/__init__.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/utils/irc/__init__.py b/src/utils/irc/__init__.py
index 2da9db08..9c19f911 100644
--- a/src/utils/irc/__init__.py
+++ b/src/utils/irc/__init__.py
@@ -63,7 +63,7 @@ class IRCArgs(object):
def __getitem__(self, index) -> str:
return self._args[index]
-def _tag_str(tags: dict) -> str:
+def _tag_str(tags: typing.Dict[str, str]) -> str:
tag_str = ""
for tag, value in tags.items():
if tag_str:
@@ -77,7 +77,8 @@ def _tag_str(tags: dict) -> str:
class IRCParsedLine(object):
def __init__(self, command: str, args: typing.List[str],
- prefix: IRCHostmask = None, tags: dict = None):
+ prefix: IRCHostmask=None,
+ tags: typing.Dict[str, str]={}):
self.command = command
self._args = args
self.args = IRCArgs(args)
@@ -318,7 +319,8 @@ def parse_ctcp(s: str) -> typing.Optional[CTCPMessage]:
return None
class IRCBatch(object):
- def __init__(self, identifier: str, batch_type: str, tags: dict=None):
+ def __init__(self, identifier: str, batch_type: str, tags:
+ typing.Dict[str, str]={}):
self.id = identifier
self.type = batch_type
self.tags = tags
@@ -329,9 +331,9 @@ class IRCSendBatch(IRCBatch):
def _add_line(self, line: IRCParsedLine):
line.tags["batch"] = self.id
self.lines.append(line)
- def message(self, target: str, message: str, tags: dict=None):
+ def message(self, target: str, message: str, tags: dict={}):
self._add_line(utils.irc.protocol.message(target, message, tags))
- def notice(self, target: str, message: str, tags: dict=None):
+ def notice(self, target: str, message: str, tags: dict={}):
self._add_line(utils.irc.protocol.notice(target, message, tags))
def trailing(s: str) -> str: