def _parse_version_str(version: str): m = re.fullmatch(MAJOR_MINOR_VERSION_RE, version) if not m: raise errors.InvalidVersionError(version) d = m.groupdict() return (d["major"], d["minor"] if d.get("minor") else None)
def _check_version_number(minor_or_major): if minor_or_major and not re.fullmatch("^[0-9]+$", minor_or_major): raise errors.InvalidVersionError( f"Invalid version `{minor_or_major}` is not a number")
def check_version_valid(cls, name: str): if name and not re.fullmatch(GENERIC_ASSET_VERSION_RE, name): raise errors.InvalidVersionError( f"Invalid version `{name}`, can only contain [a-zA-Z0-9], [-._]" )
def _check_major_version(major_version, minor_version): if minor_version and not major_version: raise errors.InvalidVersionError( "Cannot specify a minor version without a major version.")
def check_version_valid(cls, version: str): if not re.fullmatch(DATE_RE, version): raise errors.InvalidVersionError(f"Invalid version `{version}`")