o
    }oi*                     @   s    d dl mZ G dd deZdS )    )Enumc                   @   s*   e Zd ZdZdd ZedefddZdS )PrettyStrEnuma  
    Pretty enum to work with string values for config options with choices
    Provides en automatic error message with possible values, if the value is not in the enum
    Converting to string will show the actual string value, which makes serialization/deserialization straightforward

    Example:
        class ASRModelType(PrettyStrEnum):
            CTC = "ctc"
            RNNT = "rnnt"
        ...
        model_type = ModelType(model_type_string)  # automatically validated
        if model_type == ModelType.CTC:  # more error-prone (to typos) compared to pure string literals
            ...  # do something specific to CTC model
    c                 C   s   | j S )N)value)self r   C/home/ubuntu/.local/lib/python3.10/site-packages/nemo/utils/enum.py__str__"   s   zPrettyStrEnum.__str__r   c                 C   s*   d tt| }t| d| j d| )Nz, z is not a valid z. Possible choices: )joinmapstr
ValueError__name__)clsr   choicesr   r   r   	_missing_%   s   zPrettyStrEnum._missing_N)r   
__module____qualname____doc__r   classmethodobjectr   r   r   r   r   r      s
    r   N)enumr   r   r   r   r   r   <module>   s   