Skip to content

Commit

Permalink
Another attempt at fixing the StrEnum issue
Browse files Browse the repository at this point in the history
  • Loading branch information
albireox committed Dec 21, 2024
1 parent 956c790 commit 8438d4e
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/lvmopstools/pubsub.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import json
import time
import uuid
from enum import StrEnum, auto
from enum import Enum, auto

from typing import (
TYPE_CHECKING,
Expand Down Expand Up @@ -47,6 +47,14 @@
MessageType = Literal["event", "notification", "custom"]


class StrEnum(Enum):
"""Upper-case string enumeration."""

@staticmethod
def _generate_next_value_(name, *_) -> str:
return name.upper()


class Event(StrEnum):
"""Enumeration with the event types."""

Expand All @@ -69,10 +77,6 @@ class Event(StrEnum):
UNEXPECTED_FIBSEL_REHOME = auto()
UNCATEGORISED = auto()

@staticmethod
def _generate_next_value_(name, *_) -> str:
return name.upper()


class PublishedMessageModel(BaseModel):
"""A model for messages published to the exchange."""
Expand Down

0 comments on commit 8438d4e

Please sign in to comment.