"""Semantic release versions and channel-aware update selection.""" from __future__ import annotations import argparse from dataclasses import dataclass import json import re from typing import Iterable, Sequence STABLE_CHANNEL = "stable" PRERELEASE_CHANNEL = "prerelease" SUPPORTED_CHANNELS = frozenset({STABLE_CHANNEL, PRERELEASE_CHANNEL}) ACTIVE_STATUS = "active" WITHDRAWN_STATUS = "withdrawn" BLOCKED_STATUS = "blocked" SUPPORTED_RELEASE_STATUSES = frozenset( {ACTIVE_STATUS, WITHDRAWN_STATUS, BLOCKED_STATUS} ) _VERSION_PATTERN = re.compile( r"(?P0|[1-9][0-9]*)\." r"(?P0|[1-9][0-9]*)\." r"(?P0|[1-9][0-9]*)" r"(?:-(?P