take tags that might be prefixed with a keyword and return only the version part
    :param tags: an iterable of tags
    :param config: optional configuration object
978006
def tags_to_versions(tags, config=None):
    
    result = []
    for tag in tags:
        tag = tag_to_version(tag, config=config)
        if tag:
            result.append(tag)
    return result
508153
public ConfigurationItem withTags(java.util.Map<String, String> tags) {
        setTags(tags);
        return this;
    }
369820
def git_versions_from_keywords(keywords, tag_prefix, verbose):
    """"""
    if not keywords:
        raise NotThisMethod("no keywords at all, weird")
    date = keywords.get("date")
    if date is not None:
        # git-2.2.0 added "%cI", which expands to an ISO-8601 -compliant
        # datestamp. However we prefer "%ci" (which expands to an "ISO-8601
        # -like" string, which we must then edit to make compliant), because
        # it's been around since git-1.5.3, and it's too difficult to
        # discover which version we're using, or to work around using an
        # older one.
        date = date.strip().replace(" ", "T", 1).replace(" ", "", 1)
    refnames = keywords["refnames"].strip()
    if refnames.startswith("$Format"):
        if verbose:
            print("keywords are unexpanded, not using")
        raise NotThisMethod("unexpanded keywords, not a git-archive tarball")
    refs = set([r.strip() for r in refnames.strip("()").split(",")])
    # starting in git-1.8.3, tags are listed as "tag: foo-1.0" instead of
    # just "foo-1.0". If we see a "tag: " prefix, prefer those.
    TAG = "tag: "
    tags = set([r[len(TAG):] for r in refs if r.startswith(TAG)])
    if not tags:
        # Either we're using git < 1.8.3, or there really are no tags. We use
        # a heuristic: assume all version tags have a digit. The old git %d
        # expansion behaves like git log --decorate=short and strips out the
        # refs/heads/ and refs/tags/ prefixes that would let us distinguish
        # between branches and tags. By ignoring refnames without digits, we
        # filter out many common branch names like "release" and
        # "stabilization", as well as "HEAD" and "master".
        tags = set([r for r in refs if re.search(r'\d', r)])
        if verbose:
            print("discarding '%s', no digits" % ",".join(refs - tags))
    if verbose:
        print("likely tags: %s" % ",".join(sorted(tags)))
    for ref in sorted(tags):
        # sorting will prefer e.g. "2.0" over "2.0rc1"
        if ref.startswith(tag_prefix):
            r = ref[len(tag_prefix):]
            if verbose:
                print("picking %s" % r)
            return {"version": r,
                    "full-revisionid": keywords["full"].strip(),
                    "dirty": False, "error": None,
                    "date": date, "branch": None}
    # no suitable tags, so version is "0+unknown", but full hex is still there
    if verbose:
        print("no suitable tags, using unknown + full revision id")
    return {"version": "0+unknown",
            "full-revisionid": keywords["full"].strip(),
            "dirty": False, "error": "no suitable tags", "date": None,
            "branch": None}
1304683
def create_tag(version: Union[Version, str], tag_format: Optional[str] = None):
    
    if isinstance(version, str):
        version = Version(version)

    if not tag_format:
        return version.public

    major, minor, patch = version.release
    prerelease = ""
    if version.is_prerelease:
        prerelease = f"{version.pre[0]}{version.pre[1]}"

    t = Template(tag_format)
    return t.safe_substitute(
        version=version, major=major, minor=minor, patch=patch, prerelease=prerelease
    )
157637
def __get_tags(vm_):
    '''
    
    '''
    t = config.get_cloud_config_value(
        'tags', vm_, __opts__,
        default='[]', search_global=False)
    # Consider warning the user that the tags in the cloud profile
    # could not be interpreted, bad formatting?
    try:
        tags = literal_eval(t)
    except Exception:  # pylint: disable=W0703
        tags = None
    if not tags or not isinstance(tags, list):
        tags = None
    return tags
46448
def get_version_from_tag(tag_name: str) -> Optional[str]:
    

    debug('get_version_from_tag({})'.format(tag_name))
    check_repo()
    for i in repo.tags:
        if i.name == tag_name:
            return i.commit.hexsha
    return None
168516
def lookup_tag_due_date
      config.fetch(:tags).fetch(match[:tag])
    rescue KeyError
      msg = "#{match[:tag]} tag not defined in config file"
      raise KeyError, msg
    end
1180862
def ConfigSectionMap(Config, section):
    
    cfg = {}
    options = Config.options(section)
    for option in options:
        try:
            cfg[option] = Config.get(section, option)
            if cfg[option] == -1:
                logging.debug("skip: {0}".format(option))
        except:
            logging.debug("exception on {0}!".format(option))
            cfg[option] = None
    return cfg
129048
def validate_version(self, prefix='v'):
        
        version = self.software_version()
        repo = self.github_repo()
        repo.releases.validate_tag(version, prefix)
        return version
510974
def parse_version_string(version_string):
    
    components = version_string.split('-') + [None, None]
    version = list(map(int, components[0].split('.')))
    build_tag = components[1] if components[1] else BUILD_TAG
    build_number = int(components[2]) if components[2] else components[2]

    return (version, build_tag, build_number)
1298006
def _parse_common(tag):
    
    if "modifiers" in tag.attrib:
        modifiers = re.split(",\s*", tag.attrib["modifiers"].strip())
        if "" in modifiers:
            modifiers.remove("")
    else:
        modifiers = None

    if "name" in tag.attrib:
        name = tag.attrib["name"]
    if "type" in tag.attrib:
        dtype = tag.attrib["type"]
    else:
        dtype = None
    if "kind" in tag.attrib:
        kind = tag.attrib["kind"]
    else:
        kind = None

    return (name, modifiers, dtype, kind)
831909
def tag(version, params):
        
        cmd = ['git', 'tag', '-a', '-m', 'v%s' % version, str(version)]
        if params:
            cmd.extend(params)

        return cmd
1036205
def pagure_specific_project_tag_filter(config, message, tags=None, *args, **kw):
    

    if not pagure_catchall(config, message):
        return False

    tags = tags.split(',') if tags else []
    tags = [tag.strip() for tag in tags if tag and tag.strip()]

    project_tags = set()
    project_tags.update(message.get('project', {}).get('tags', []))
    project_tags.update(
        message.get('pullrequest', {}).get('project', {}).get('tags', []))
    project_tags.update(
        message.get('commit', {}).get('repo', {}).get('tags', []))

    valid = len(project_tags.intersection(set(tags))) > 0

    return valid
995430
def get_tag(self, tagtype):
        ''' '''
        for tag in self.__tags:
            if tag.tagtype == tagtype:
                return tag
        return None
1088848
def handle_tags(repo, **kwargs):
    """"""
    log.info('tags: %s %s' %(repo, kwargs))
    return [str(t) for t in repo.tags(**kwargs)]
1331986
public static AliasedDiscoveryConfig getConfigByTag(JoinConfig config, String tag) {
        if ("aws".equals(tag)) {
            return config.getAwsConfig();
        } else if ("gcp".equals(tag)) {
            return config.getGcpConfig();
        } else if ("azure".equals(tag)) {
            return config.getAzureConfig();
        } else if ("kubernetes".equals(tag)) {
            return config.getKubernetesConfig();
        } else if ("eureka".equals(tag)) {
            return config.getEurekaConfig();
        } else {
            throw new IllegalArgumentException(String.format("Invalid tag: '%s'", tag));
        }
    }
515508
def slice_config(config, key):
    
    if key:
        keys = key.split('.')
        for k in keys:
            config = config[k]

    return config