Skip to content

Commit

Permalink
Remove use of ReprEnum which is only supported in 3.13
Browse files Browse the repository at this point in the history
  • Loading branch information
albireox committed Dec 21, 2024
1 parent ac6a388 commit 7782a77
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 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 ReprEnum, auto
from enum import StrEnum, auto

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


class UpperStrEnum(str, ReprEnum):
"""A string enum in which the auto value is the uppercase name."""

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


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

ERROR = auto()
Expand All @@ -77,6 +69,10 @@ class Event(UpperStrEnum):
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 7782a77

Please sign in to comment.