From 7782a774773a681685fece3f6cc4530d401548e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20S=C3=A1nchez-Gallego?= Date: Sat, 21 Dec 2024 14:23:40 -0800 Subject: [PATCH] Remove use of ReprEnum which is only supported in 3.13 --- src/lvmopstools/pubsub.py | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/lvmopstools/pubsub.py b/src/lvmopstools/pubsub.py index 9ee7a5e..d30a652 100644 --- a/src/lvmopstools/pubsub.py +++ b/src/lvmopstools/pubsub.py @@ -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, @@ -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() @@ -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."""