aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar jesopo2019-06-16 09:52:25 +0100
committerGravatar jesopo2019-06-16 09:52:25 +0100
commit055eed24fda7280b28134a6152dc31c0d43f9c70 (patch)
treee1be09b897c5a7e2df9231a247f33c9d7c14f69e /src
parentCheck that we have enough PRIVMSG args for strip_color.py (diff)
signature
Type annotate ParsedLine.tags, add ParsedLine.add_tag()
Diffstat (limited to 'src')
-rw-r--r--src/IRCLine.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/IRCLine.py b/src/IRCLine.py
index c0263d20..3a8f14b5 100644
--- a/src/IRCLine.py
+++ b/src/IRCLine.py
@@ -45,7 +45,7 @@ class ParsedLine(object):
self._args = args
self.args = IRCArgs(args)
self.source = source
- self.tags = {} if tags == None else tags
+ self.tags = tags or {} # type: typing.Dict[str, str]
self._valid = True
self._assured = False
@@ -64,6 +64,9 @@ class ParsedLine(object):
def assure(self):
self._assured = True
+ def add_tag(self, tag: str, value: str=None):
+ self.tags[tag] = value or ""
+
def _tag_str(self, tags: typing.Dict[str, str]) -> str:
tag_pieces = []
for tag, value in tags.items():