File size: 556 Bytes
a34bdcd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
"""Enum compatibility helpers for the supported Python 3.10+ runtimes."""

from __future__ import annotations

from enum import Enum


class StrEnum(str, Enum):
    """String-valued enum with the Python 3.11 ``enum.StrEnum`` behavior.

    MediaRouter supports Python 3.10, where the standard-library StrEnum does
    not exist. Keeping this small compatibility type in one place gives API,
    database, and Pydantic serialization the same string behavior on every
    supported runtime.
    """

    __str__ = str.__str__
    __format__ = str.__format__