Add MessageTag.present, to see if a tag is present (even without value)
This commit is contained in:
parent
e55cd1e98e
commit
9457430c15
1 changed files with 2 additions and 0 deletions
|
@ -317,6 +317,8 @@ class MessageTag(object):
|
||||||
def get_value(self, tags: typing.Dict[str, str]) -> typing.Optional[str]:
|
def get_value(self, tags: typing.Dict[str, str]) -> typing.Optional[str]:
|
||||||
key = list(set(tags.keys())&self._names)
|
key = list(set(tags.keys())&self._names)
|
||||||
return tags[key[0]] if key else None
|
return tags[key[0]] if key else None
|
||||||
|
def present(self, tags: typing.Dict[str, str]) -> bool:
|
||||||
|
return bool(set(tags.keys())&self._names)
|
||||||
def match(self, tag: str) -> typing.Optional[str]:
|
def match(self, tag: str) -> typing.Optional[str]:
|
||||||
key = list(set([tag])&self._names)
|
key = list(set([tag])&self._names)
|
||||||
return key[0] if key else None
|
return key[0] if key else None
|
||||||
|
|
Loading…
Reference in a new issue