<commit_before>import enum


class ChoicesEnum(enum.Enum):
    @classmethod
    def choices_gen(cls):
        for attr in cls:
            yield (attr.name, attr.value)

    @classmethod
    def choices(cls):
        return tuple(cls.choices_gen())
<commit_msg>doc: add doc for ChoicesEnum<commit_after>import enum


class ChoicesEnum(enum.Enum):
    """
        Enumerator class for use with the django ORM choices field

    Usage:
        create a class with choices as fields like this

        # choices.py
        class COLOR_TYPE(ChoicesEnum):
            red = 'Green'
            green = 'Red'

        # models.py
        ...
        models.CharField('Color', choices=COLOR_TYPE.choices(), default=COLOR_TYPE.red.name, max_length=10)
        ...
    """

    @classmethod
    def choices_gen(cls):
        for attr in cls:
            yield (attr.name, attr.value)

    @classmethod
    def choices(cls):
        return tuple(cls.choices_gen())

{'fraction_non_alphanumeric': 0.09947643979057591, 'fraction_numerical': 0.0020942408376963353, 'mean_word_length': 2.176079734219269, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3789374', 'n_tokens_mistral': 291, 'n_tokens_neox': 281, 'n_words': 74}