Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-48216: Use StrEnum instead of dual inheritance #453

Merged
merged 1 commit into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions client/src/rubin/nublado/client/models/_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
from __future__ import annotations

from abc import ABCMeta, abstractmethod
from enum import Enum
from enum import Enum, StrEnum
from typing import Literal, override

from pydantic import BaseModel, Field


class NubladoImageClass(str, Enum):
class NubladoImageClass(StrEnum):
"""Possible ways of selecting an image."""

__slots__ = ()
Expand Down
6 changes: 3 additions & 3 deletions controller/src/controller/models/domain/kubernetes.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from __future__ import annotations

from dataclasses import dataclass
from enum import Enum
from enum import Enum, StrEnum
from typing import Annotated, Any, Protocol, Self, override

from kubernetes_asyncio.client import (
Expand Down Expand Up @@ -599,7 +599,7 @@ def to_kubernetes(self) -> V1Affinity:
)


class PodPhase(str, Enum):
class PodPhase(StrEnum):
"""One of the valid phases reported in the status section of a Pod."""

PENDING = "Pending"
Expand Down Expand Up @@ -759,7 +759,7 @@ def to_kubernetes(self) -> V1Toleration:
)


class VolumeAccessMode(str, Enum):
class VolumeAccessMode(StrEnum):
"""Access mode for a persistent volume.

The access modes ``ReadWriteOnce`` and ``ReadWriteOncePod`` are valid
Expand Down
4 changes: 2 additions & 2 deletions controller/src/controller/models/v1/lab.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from __future__ import annotations

from enum import Enum
from enum import Enum, StrEnum
from typing import Annotated, Any, Self

from kubernetes_asyncio.client import V1ResourceRequirements
Expand Down Expand Up @@ -35,7 +35,7 @@
]


class LabSize(str, Enum):
class LabSize(StrEnum):
"""Allowable names for pod sizes.

Taken from `d20 creature sizes`_.
Expand Down
4 changes: 2 additions & 2 deletions spawner/src/rubin/nublado/spawner/_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
from __future__ import annotations

from dataclasses import dataclass
from enum import Enum
from enum import StrEnum

from httpx_sse import ServerSentEvent


class LabStatus(str, Enum):
class LabStatus(StrEnum):
"""Possible status conditions of a user's pod per the lab controller.

This is not directly equivalent to pod phases. It is instead intended to
Expand Down
Loading