<commit_before>import urwid

COL_WIDTH_ID = 4
COL_WIDTH_NAME = 32
COL_WIDTH_COST = 7
COL_WIDTH_QTY = 3
COL_WIDTH_BARCODE = 15
COL_WIDTH_EDITBUTTON = 10
COL_DIVIDER_WIDTH = 2

class ProductEditor(urwid.WidgetWrap):
    def __init__(self):
        self._product = None

        self._id = urwid.Text("ID:        ")
        self._name = urwid.Edit("Name:     ")
        self._cost = urwid.Edit("Cost:     ")
        self._qty = urwid.IntEdit("Quantity: ")
        self._barcode = urwid.Edit("Barcode:  ")
        self._save_button = urwid.Button("save")
        self._new_button = urwid.Button("new")
        self._delete_button = urwid.Button("delete")

        button_flow = urwid.GridFlow([
            self._save_button,
            self._new_button,
            self._delete_button
        ], 10, 1, 0, 'left')

        display_widget = urwid.Pile([
            self._id,
            self._name,
            self._cost,
            self._qty,
            self._barcode,
            button_flow
        ])

        urwid.WidgetWrap.__init__(self, display_widget)

    def commit(self):
        product = self._product

        product.name = self._name.edit_text
        product.cost = float(self._cost.edit_text)
        product.qty = int(self._qty.edit_text)
        product.upc = self._barcode.edit_text

    def refresh(self):
        if not hasattr(self, '_product'):
            return<commit_msg>Move barcode nearer to name since those are edited most<commit_after>import urwid

COL_WIDTH_ID = 4
COL_WIDTH_NAME = 32
COL_WIDTH_COST = 7
COL_WIDTH_QTY = 3
COL_WIDTH_BARCODE = 15
COL_WIDTH_EDITBUTTON = 10
COL_DIVIDER_WIDTH = 2

class ProductEditor(urwid.WidgetWrap):
    def __init__(self):
        self._product = None

        self._id = urwid.Text("ID:        ")
        self._name = urwid.Edit("Name:     ")
        self._cost = urwid.Edit("Cost:     ")
        self._qty = urwid.IntEdit("Quantity: ")
        self._barcode = urwid.Edit("Barcode:  ")
        self._save_button = urwid.Button("save")
        self._new_button = urwid.Button("new")
        self._delete_button = urwid.Button("delete")

        button_flow = urwid.GridFlow([
            self._save_button,
            self._new_button,
            self._delete_button
        ], 10, 1, 0, 'left')

        display_widget = urwid.Pile([
            self._id,
            self._name,
            self._barcode,
            self._cost,
            self._qty,
            button_flow
        ])

        urwid.WidgetWrap.__init__(self, display_widget)

    def commit(self):
        product = self._product

        product.name = self._name.edit_text
        product.cost = float(self._cost.edit_text)
        product.qty = int(self._qty.edit_text)
        product.upc = self._barcode.edit_text

    def refresh(self):
        if not hasattr(self, '_product'):
            return
{'fraction_non_alphanumeric': 0.10666666666666667, 'fraction_numerical': 0.009824561403508772, 'mean_word_length': 2.032978723404255, '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': '4746768', 'n_tokens_mistral': 932, 'n_tokens_neox': 888, 'n_words': 160}