Shim StrEnum

This commit is contained in:
huchenlei 2024-11-19 19:47:43 -05:00
parent 6556ccc40b
commit ddb6626329

View File

@ -2,7 +2,14 @@
from typing import Literal, TypedDict from typing import Literal, TypedDict
from abc import ABC, abstractmethod from abc import ABC, abstractmethod
from enum import StrEnum from enum import Enum
class StrEnum(str, Enum):
"""Base class for string enums. Python's StrEnum is not available until 3.11."""
def __str__(self) -> str:
return self.value
class IO(StrEnum): class IO(StrEnum):