INNER CODE UNIT · Python

version

lissy93/portainer-templates · lib/changelog.py:39

def version(tag):
    """Numeric (major, minor, patch) tuple for a vX.Y.Z tag"""
    return tuple(int(p) for p in tag[1:].split('.'))

def semver_tags():
    """All vMAJOR.MINOR.PATCH tags from FIRST_VERSION onwards, oldest first"""
    tags = [t for t in git('tag').splitlines() if SEMVER_TAG.match(t)]
    return sorted((t for t in tags if version(t) >= FIRST_VERSION), key=version)

def tag_dates():
    """Map of tag -> creation date (YYYY-MM-DD)"""
    lines = git('for-each-ref', '--format=%(refname:short) %(creatordate:short)',
                'refs/tags').splitlines()
    return dict(line.split(' ', 1) for line in lines if ' ' in line)

def templates_at(tag):
    """Templates in templates.json at a tag, keyed by title with `id` dropped.
    Returns None if the file doesn't exist at that tag."""

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…