Skip to content

Commit 2be8b05

Browse files
fix breaking changes to new str-enum mixin behaviour in Py3.11
See: python/cpython#100458
1 parent cdb3c75 commit 2be8b05

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

packages/models-library/src/models_library/basic_types.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import re
2-
from enum import Enum
2+
from enum import StrEnum
33
from typing import TypeAlias
44

55
from pydantic import (
@@ -116,14 +116,14 @@ class HttpUrlWithCustomMinLength(HttpUrl):
116116
min_length = 0
117117

118118

119-
class LogLevel(str, Enum):
119+
class LogLevel(StrEnum):
120120
DEBUG = "DEBUG"
121121
INFO = "INFO"
122122
WARNING = "WARNING"
123123
ERROR = "ERROR"
124124

125125

126-
class BootModeEnum(str, Enum):
126+
class BootModeEnum(StrEnum):
127127
"""
128128
Values taken by SC_BOOT_MODE environment variable
129129
set in Dockerfile and used during docker/boot.sh
@@ -140,7 +140,7 @@ def is_devel_mode(self) -> bool:
140140
return self in (self.DEBUG, self.DEVELOPMENT, self.LOCAL)
141141

142142

143-
class BuildTargetEnum(str, Enum):
143+
class BuildTargetEnum(StrEnum):
144144
"""
145145
Values taken by SC_BUILD_TARGET environment variable
146146
set in Dockerfile that defines the stage targeted in the

packages/settings-library/src/settings_library/r_clone.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
from enum import Enum
1+
from enum import StrEnum
22

33
from pydantic import Field, NonNegativeInt
44

55
from .base import BaseCustomSettings
66
from .s3 import S3Settings
77

88

9-
class S3Provider(str, Enum):
9+
class S3Provider(StrEnum):
1010
AWS = "AWS"
1111
CEPH = "CEPH"
1212
MINIO = "MINIO"

services/director-v2/tests/unit/test_core_settings.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222

2323
def _get_backend_type_options() -> set[str]:
24-
return {x.value for x in S3Provider if not x.startswith("_")}
24+
return {x for x in S3Provider if not x.startswith("_")}
2525

2626

2727
def test_supported_backends_did_not_change() -> None:

0 commit comments

Comments
 (0)