From 9519b30ee6466c5a1a9686714e42177bb7af9301 Mon Sep 17 00:00:00 2001 From: fubuloubu <3859395+fubuloubu@users.noreply.github.com> Date: Wed, 10 Apr 2024 16:55:38 -0400 Subject: [PATCH] refactor: use official backport --- setup.py | 1 + silverback/types.py | 6 +----- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/setup.py b/setup.py index bd8015d9..5ed6271e 100644 --- a/setup.py +++ b/setup.py @@ -72,6 +72,7 @@ "eth-pydantic-types", # Use same version as eth-ape "pydantic_settings", # Use same version as eth-ape "taskiq[metrics]>=0.10.4,<0.11.0", + "backports.strenum ; python_version<'3.11'", ], entry_points={ "console_scripts": ["silverback=silverback._cli:cli"], diff --git a/silverback/types.py b/silverback/types.py index 70a42891..c6c19b86 100644 --- a/silverback/types.py +++ b/silverback/types.py @@ -7,11 +7,7 @@ from enum import StrEnum # Only Python 3.11+ except ImportError: - from enum import Enum - - class StrEnum(str, Enum): # type: ignore[no-redef] - def __str__(self) -> str: - return self.value + from backports.strenum import StrEnum # type: ignore[no-redef] class TaskType(StrEnum):