Type annotate ParsedLine.tags, add ParsedLine.add_tag()

This commit is contained in:
jesopo 2019-06-16 09:52:25 +01:00
parent 5b58cc05b6
commit 055eed24fd

View file

@ -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():