from __future__ import annotations
from enum import Enum
class ValuedEnum(str, Enum):
def __str__(self) -> str:
"""Return the string representation of this enum's value.
:return: String value of the enum.
"""
return str(self.value)
[docs]
class ModelVisibility(ValuedEnum):
"""Whether a model is publicly visible or not."""
PRIVATE = "private"
PUBLIC = "public"
[docs]
class SchemaKind(ValuedEnum):
"""A type of schema."""
MODEL = "model"
ACCESS_REQUEST = "accessRequest"
[docs]
class Role(ValuedEnum):
"""A reviewing role."""
OWNER = "owner"
CONTRIBUTOR = "contributor"
CONSUMER = "consumer"
[docs]
class EntryKind(ValuedEnum):
"""The type of model."""
MODEL = "model"
DATACARD = "data-card"
[docs]
class MinimalSchema(ValuedEnum):
"""A minimal schema."""
MODEL = "minimal-general-v10"
DATACARD = "minimal-data-card-v10"
ACCESS_REQUEST = "minimal-access-request-general-v10"
[docs]
class CollaboratorEntry(dict):
"""A set of roles linked to a given entity (a.k.a. user)."""
[docs]
def __init__(self, entity: str, roles: list[Role | str]) -> None:
"""Initialise a CollaboratorEntry.
:param entity: The entity (e.g. user) identifier.
:param roles: List of roles assigned to the entity.
"""
super().__init__(self, entity=entity, roles=roles)