AlaK4X
Linux lhjmq-records 5.15.0-118-generic #128-Ubuntu SMP Fri Jul 5 09:28:59 UTC 2024 x86_64



Your IP : 3.129.22.34


Current Path : /usr/lib/python3/dist-packages/landscape/lib/
Upload File :
Current File : //usr/lib/python3/dist-packages/landscape/lib/tag.py

import re


_tag_check = re.compile(r"^\w+[\w-]*$", re.UNICODE)


def is_valid_tag(tagname):
    """Return True if the tag meets our tag requirements."""
    return _tag_check.match(tagname)


def is_valid_tag_list(tag_list):
    """Validate a tag_list string.

    @param tag_list: string like london, server which will be split on the
    commas and each tag verified for validity.
    """
    if not tag_list:
        return True
    return all(is_valid_tag(tag.strip()) for tag in tag_list.split(","))