<commit_before>from prettytable import PrettyTable
from datetime import datetime

from pynote import config
from pynote import container


class DataTable(container.Data):

    def __init__(self, tags=None):
        super().__init__()
        self.table = self._create_empty_table()
        self.tags = tags
        self._fill_table()

    def _create_empty_table(self):
        table = PrettyTable(['id', 'title', 'updated'], print_empty=False)
        table.sortby = 'updated'
        table.align = 'l'
        table.reversesort = True
        return table

    def _fill_table(self):
        for key, note in enumerate(self.data):
            title = note.title
            updated = note.updated.strftime(config.DATEFORMAT)

            if self.tags is None:
                self.table.add_row([key, title, updated])
            else:
                for tag in self.tags:
                    if note.has_tag(tag):
                        self.table.add_row([key, title, updated])
                        break

    def __bool__(self):
        if self.table.get_string():
            return True
        else:<commit_msg>Little code cleanup<commit_after>from prettytable import PrettyTable
from datetime import datetime

from pynote import config
from pynote import container


class DataTable(container.Data):

    def __init__(self, tags=None):
        super().__init__()
        self.tags = tags
        self.table = self._create_table()

    def _create_table(self):
        table = PrettyTable(['id', 'title', 'updated'], print_empty=False)
        table.sortby = 'updated'
        table.align = 'l'
        table.reversesort = True

        for key, note in enumerate(self.data):
            title = note.title
            updated = note.updated.strftime(config.DATEFORMAT)

            if self.tags is None:
                table.add_row([key, title, updated])
            else:
                for tag in self.tags:
                    if note.has_tag(tag):
                        table.add_row([key, title, updated])
                        break
        return table

    def __bool__(self):
        if self.table.get_string():
            return True
        else:
{'fraction_non_alphanumeric': 0.0926605504587156, 'fraction_numerical': 0.0, 'mean_word_length': 1.8659658344283836, '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': '758179', 'n_tokens_mistral': 604, 'n_tokens_neox': 572, 'n_words': 154}