<commit_before>from enum import Enum
from collections import namedtuple
from functools import partial


class OrderedEnum(Enum):
    def __ge__(self, other):
        if self.__class__ is other.__class__:
            return self.value >= other.value
        return NotImplemented

    def __gt__(self, other):
        if self.__class__ is other.__class__:
            return self.value > other.value
        return NotImplemented

    def __le__(self, other):
        if self.__class__ is other.__class__:
            return self.value <= other.value
        return NotImplemented

    def __lt__(self, other):
        if self.__class__ is other.__class__:
            return self.value < other.value
        return NotImplemented


def valid_string_for_enum(enum, s):
    return s in enum.__members__


def enum_from_string(enum, s):
    return enum.__members__[s]


Restaurant = OrderedEnum('Restaurant', ['r1', 'r2'])
valid_string_for_restaurant = partial(valid_string_for_enum, Restaurant)
restaurant_from_string = partial(enum_from_string, Restaurant)


DishType = OrderedEnum('DishType', ['menu1', 'menu2', 'vegetarian',
                                    'speciality', 'grill', 'pasta', 'pizza'])
valid_string_for_dishtype = partial(valid_string_for_enum, DishType)
dishtype_from_string = partial(enum_from_string, DishType)


MenuItem = namedtuple('MenuItem', ['restaurant', 'date', 'type',
                                   'name', 'price'])<commit_msg>Ordered enum no longer needed.<commit_after>from enum import Enum
from collections import namedtuple
from functools import partial


def valid_string_for_enum(enum, s):
    return s in enum.__members__


def enum_from_string(enum, s):
    return enum.__members__[s]


Restaurant = Enum('Restaurant', ['r1', 'r2'])
valid_string_for_restaurant = partial(valid_string_for_enum, Restaurant)
restaurant_from_string = partial(enum_from_string, Restaurant)


DishType = Enum('DishType', ['menu1', 'menu2', 'vegetarian',
                                    'speciality', 'grill', 'pasta', 'pizza'])
valid_string_for_dishtype = partial(valid_string_for_enum, DishType)
dishtype_from_string = partial(enum_from_string, DishType)


MenuItem = namedtuple('MenuItem', ['restaurant', 'date', 'type',
                                   'name', 'price'])
{'fraction_non_alphanumeric': 0.1016949152542373, 'fraction_numerical': 0.003476749239461104, 'mean_word_length': 3.469902912621359, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '593462', 'n_tokens_mistral': 703, 'n_tokens_neox': 672, 'n_words': 165}