Spaces:
Sleeping
Sleeping
Antigravity AI commited on
Commit ·
82c4d2e
1
Parent(s): 6a43f46
Fix Python 3.10 compatibility: add StrEnum fallback
Browse files
rvc_logic/core/exceptions.py
CHANGED
|
@@ -7,7 +7,14 @@ from __future__ import annotations
|
|
| 7 |
|
| 8 |
from typing import TYPE_CHECKING, Literal
|
| 9 |
|
| 10 |
-
from enum import
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
|
| 12 |
if TYPE_CHECKING:
|
| 13 |
from rvc_logic.typing_extra import StrPath, TrainingSampleRate
|
|
|
|
| 7 |
|
| 8 |
from typing import TYPE_CHECKING, Literal
|
| 9 |
|
| 10 |
+
from enum import Enum
|
| 11 |
+
try:
|
| 12 |
+
from enum import StrEnum
|
| 13 |
+
except ImportError:
|
| 14 |
+
class StrEnum(str, Enum):
|
| 15 |
+
def __str__(self) -> str:
|
| 16 |
+
return str(self.value)
|
| 17 |
+
|
| 18 |
|
| 19 |
if TYPE_CHECKING:
|
| 20 |
from rvc_logic.typing_extra import StrPath, TrainingSampleRate
|
rvc_logic/typing_extra.py
CHANGED
|
@@ -3,7 +3,14 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from collections.abc import Mapping, Sequence
|
| 6 |
-
from enum import IntEnum,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
from os import PathLike
|
| 8 |
|
| 9 |
type StrPath = str | PathLike[str]
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from collections.abc import Mapping, Sequence
|
| 6 |
+
from enum import IntEnum, Enum
|
| 7 |
+
try:
|
| 8 |
+
from enum import StrEnum
|
| 9 |
+
except ImportError:
|
| 10 |
+
class StrEnum(str, Enum):
|
| 11 |
+
def __str__(self) -> str:
|
| 12 |
+
return str(self.value)
|
| 13 |
+
|
| 14 |
from os import PathLike
|
| 15 |
|
| 16 |
type StrPath = str | PathLike[str]
|