<commit_before>from datetime import datetime

import urwid


class TodoEditor:
    """
    The UI for a single todo entry.
    """

    def __init__(self, todo, formatter):
        """
        :param model.Todo todo: The todo object which will be edited.
        """

        self.todo = todo
        self.formatter = formatter
        self.saved = False

        if todo.due:
            # TODO: use proper date_format
            due = formatter.format_date(todo.due)
        else:
            due = ""

        self._summary = urwid.Edit(edit_text=todo.summary)
        self._description = urwid.Edit(edit_text=todo.description,
                                       multiline=True)
        self._location = urwid.Edit(edit_text=todo.location)
        self._due = urwid.Edit(edit_text=due)
        self._completed = urwid.CheckBox("", state=todo.completed is not None)
        self._urgent = urwid.CheckBox("", state=todo.priority)

        save_btn = urwid.Button('Save', on_press=self._save)
        cancel_btn = urwid.Button('Cancel', on_press=self._cancel)
        buttons = urwid.Columns([(10, cancel_btn), (8, save_btn)],
                                dividechars=2)

        pile_items = []
        for label, field in [("Summary", self._summary),
                             ("Description", self._description),
                             ("Location", self._location),
                             ("Due", self._due),
                             ("Completed", self._completed),
                             ("Urgent", self._urgent),
                             ]:
            label = urwid.Text(label + ":", align='right')<commit_msg>Unbreak edit dialog for urgent tasks.<commit_after>from datetime import datetime

import urwid


class TodoEditor:
    """
    The UI for a single todo entry.
    """

    def __init__(self, todo, formatter):
        """
        :param model.Todo todo: The todo object which will be edited.
        """

        self.todo = todo
        self.formatter = formatter
        self.saved = False

        if todo.due:
            # TODO: use proper date_format
            due = formatter.format_date(todo.due)
        else:
            due = ""

        self._summary = urwid.Edit(edit_text=todo.summary)
        self._description = urwid.Edit(edit_text=todo.description,
                                       multiline=True)
        self._location = urwid.Edit(edit_text=todo.location)
        self._due = urwid.Edit(edit_text=due)
        self._completed = urwid.CheckBox("", state=todo.completed is not None)
        self._urgent = urwid.CheckBox("", state=todo.priority not in [None, 0])

        save_btn = urwid.Button('Save', on_press=self._save)
        cancel_btn = urwid.Button('Cancel', on_press=self._cancel)
        buttons = urwid.Columns([(10, cancel_btn), (8, save_btn)],
                                dividechars=2)

        pile_items = []
        for label, field in [("Summary", self._summary),
                             ("Description", self._description),
                             ("Location", self._location),
                             ("Due", self._due),
                             ("Completed", self._completed),
                             ("Urgent", self._urgent),
                             ]:
            label = urwid.Text(label + ":", align='right')
{'fraction_non_alphanumeric': 0.11360239162929746, 'fraction_numerical': 0.0026905829596412557, 'mean_word_length': 1.6408839779005524, 'pattern_counts': {'":': 2, '<': 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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6560435', 'n_tokens_mistral': 930, 'n_tokens_neox': 892, 'n_words': 198}