add has_tag() and get_tag() to IRCLine.ParsedLine

This commit is contained in:
jesopo 2019-06-18 15:18:44 +01:00
parent 31be78db81
commit 51cac7d9b5

View file

@ -66,6 +66,10 @@ class ParsedLine(object):
def add_tag(self, tag: str, value: str=None): def add_tag(self, tag: str, value: str=None):
self.tags[tag] = value or "" self.tags[tag] = value or ""
def has_tag(self, tag: str) -> bool:
return "tag" in self.tags
def get_tag(self, tag: str) -> typing.Optional[str]:
return self.tags[tag]
def _tag_str(self, tags: typing.Dict[str, str]) -> str: def _tag_str(self, tags: typing.Dict[str, str]) -> str:
tag_pieces = [] tag_pieces = []