From 0ce5d2e874d649ef543ec2f214b1aaa7f23ff294 Mon Sep 17 00:00:00 2001 From: taro-kayo <40859826+taro-kayo@users.noreply.github.com> Date: Sat, 27 May 2023 09:12:14 +0900 Subject: [PATCH] fix: Enum with str or int Mixin Breaking Change in Python 3.11 https://github.com/python/cpython/issues/100458 --- statelint/fields/common.py | 6 +++--- statelint/problem/problem_type.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/statelint/fields/common.py b/statelint/fields/common.py index 7b674f3..f61e63e 100644 --- a/statelint/fields/common.py +++ b/statelint/fields/common.py @@ -1,9 +1,9 @@ import json -from enum import Enum +from enum import StrEnum from typing import Any -class Comparison(str, Enum): +class Comparison(StrEnum): STRING_EQUALS = "StringEquals" STRING_LESS_THAN = "StringLessThan" STRING_GREATER_THAN = "StringGreaterThan" @@ -45,7 +45,7 @@ class Comparison(str, Enum): STRING_MATCHES = "StringMatches" -class StateType(str, Enum): +class StateType(StrEnum): PASS = "Pass" SUCCEED = "Succeed" FAIL = "Fail" diff --git a/statelint/problem/problem_type.py b/statelint/problem/problem_type.py index 1936bba..eaee10b 100644 --- a/statelint/problem/problem_type.py +++ b/statelint/problem/problem_type.py @@ -1,7 +1,7 @@ -from enum import Enum +from enum import StrEnum -class ProblemType(str, Enum): +class ProblemType(StrEnum): # type check FLOAT = "a Float" STRING = "a String"