From 055eed24fda7280b28134a6152dc31c0d43f9c70 Mon Sep 17 00:00:00 2001 From: jesopo Date: Sun, 16 Jun 2019 09:52:25 +0100 Subject: Type annotate ParsedLine.tags, add ParsedLine.add_tag() --- src/IRCLine.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') 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(): -- cgit v1.3.1-10-gc9f91