<commit_before># pylint: disable=C0111
# https://github.com/PyCQA/pylint/issues/1553
# pylint: disable=W0221
from decimal import Decimal
from django.db import models
from django.urls import reverse


ORDER_STATES = (
    ('preparing', ''),
    ('ordering', ''),
    ('ordered', ''),
    ('delivered', ''),
    ('canceled', ''),
)


class Order(models.Model):
    """
    Represents an order which is used to help coordinate food delivery for multiple users.

    Users can add order items as they like when the state is preparing.
    """

    class Meta:  # noqa
        ordering = ('history__created_at', )

    coordinator = models.CharField(max_length=100)
    restaurant_name = models.CharField(max_length=250)
    state = models.CharField(max_length=16, choices=ORDER_STATES, default='preparing')
    # TODO remove this and always generate from state changes?
    created_at = models.DateTimeField(auto_now_add=True)

    def get_absolute_url(self):
        """Return public url to view single order."""
        return reverse('orders:view_order', kwargs={'order_slug': self.pk})

    def __expect_states(self, expected_state):
        if self.state not in expected_state:
            raise ValueError("Need state '{}' but is '{}'".format(expected_state, self.state))
<commit_msg>fix(order): Add textual descriptions to order states<commit_after># pylint: disable=C0111
# https://github.com/PyCQA/pylint/issues/1553
# pylint: disable=W0221
from decimal import Decimal
from django.db import models
from django.urls import reverse


ORDER_STATES = (
    ('preparing', 'Order is prepared, order items can be modified.'),
    ('ordering', 'Order is locked and sent to delivery service by coordinator.'),
    ('ordered', 'Order has been sent to delivery service.'),
    ('delivered', 'Delivery has arrived.'),
    ('canceled', 'Order has been canceled due to some reason.'),
)


class Order(models.Model):
    """
    Represents an order which is used to help coordinate food delivery for multiple users.

    Users can add order items as they like when the state is preparing.
    """

    class Meta:  # noqa
        ordering = ('history__created_at', )

    coordinator = models.CharField(max_length=100)
    restaurant_name = models.CharField(max_length=250)
    state = models.CharField(max_length=16, choices=ORDER_STATES, default='preparing')
    # TODO remove this and always generate from state changes?
    created_at = models.DateTimeField(auto_now_add=True)

    def get_absolute_url(self):
        """Return public url to view single order."""
        return reverse('orders:view_order', kwargs={'order_slug': self.pk})

    def __expect_states(self, expected_state):
        if self.state not in expected_state:
            raise ValueError("Need state '{}' but is '{}'".format(expected_state, self.state))

{'fraction_non_alphanumeric': 0.1144578313253012, 'fraction_numerical': 0.014174344436569808, 'mean_word_length': 3.8588640275387265, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '1523975', 'n_tokens_mistral': 850, 'n_tokens_neox': 812, 'n_words': 252}