@classmethod
  def parse(cls, version):
    # must not contain whitespace
    if not cls._VALID_NAME.match(version):
      raise ValueError("Named versions must match {}: '{}'".format(cls._VALID_NAME.pattern, version))
    if cls._INVALID_NAME.match(version):
      raise ValueError("Named version must contain at least one alphanumeric character")

    # must not be valid semver
    try:
      Semver.parse(version)
    except __HOLE__:
      return Namedver(version)
    else:
      raise ValueError("Named versions must not be valid semantic versions: '{0}'".format(version))
dataset/ETHPy150Open pantsbuild/pants/src/python/pants/task/scm_publish_mixin.py/Namedver.parse