From f4f49e805f5c99922f3a2c054a74a69d632d3d20 Mon Sep 17 00:00:00 2001 From: Kun Jinkao <45487685+Snoopy1866@users.noreply.github.com> Date: Wed, 11 Sep 2024 17:08:52 +0800 Subject: [PATCH] rm --- src/utils.py | 29 ----------------------------- 1 file changed, 29 deletions(-) delete mode 100644 src/utils.py diff --git a/src/utils.py b/src/utils.py deleted file mode 100644 index 6a5099d..0000000 --- a/src/utils.py +++ /dev/null @@ -1,29 +0,0 @@ -from enum import Enum -from typing import Type - -from .exception import EnumMemberNotExistError - - -def get_enum_by_name(enum_class: Type[Enum], name: str) -> Enum: - """根据枚举成员名的字符串表示获取枚举成员。 - - Parameters - ---------- - enum_class : Type[T] - 枚举类 - name : str - 枚举名称的字符串表示 - - Returns - ------- - T - 枚举成员 - """ - - if name is None or isinstance(name, enum_class): - return name - else: - try: - return enum_class[name.upper()] - except KeyError: - raise EnumMemberNotExistError(enum_class, name)