Skip to content

robot.model.tags

Tags

Tags(tags: Iterable[str] = ())

Bases: Sequence[str]

Source code in src/robot/model/tags.py
def __init__(self, tags: Iterable[str] = ()):
    if isinstance(tags, Tags):
        self._tags, self._reserved = tags._tags, tags._reserved
    else:
        self._tags, self._reserved = self._init_tags(tags)

robot

robot(name: str) -> bool

Check do tags contain a reserved tag in format robot:<name>.

This is same as 'robot:<name>' in tags but considerably faster.

Source code in src/robot/model/tags.py
def robot(self, name: str) -> bool:
    """Check do tags contain a reserved tag in format `robot:<name>`.

    This is same as `'robot:<name>' in tags` but considerably faster.
    """
    return name in self._reserved

normalize_tags

normalize_tags(tags: Iterable[str]) -> Iterable[str]

Performance optimization to normalize tags only once.

Source code in src/robot/model/tags.py
def normalize_tags(tags: Iterable[str]) -> Iterable[str]:
    """Performance optimization to normalize tags only once."""
    if isinstance(tags, NormalizedTags):
        return tags
    if isinstance(tags, str):
        tags = [tags]
    return NormalizedTags([normalize(t, ignore='_') for t in tags])