<commit_before>import pygame

LEFT = 1

class Gui:
    def __init__(self):
        self.gui_elements = list()

    def update(self, mouse, events):
        curr_element = None
        for element in self.gui_elements:
            if element.contains(mouse.get_pos):
                curr_element = element
                element.on_hover()

        if curr_element is not None:
            for event in events:
                # Check onMouseDown for left mouse button.
                if event.type == pygame.MOUSEBUTTONDOWN and event.button == LEFT:
                    curr_element.on_mouse_down()
                # Check onMouseUp for left mouse button.
                elif event.type == pygame.MOUSEBUTTONUP and event.button == LEFT:
                    curr_element.on_mouse_up()

        curr_element = None<commit_msg>Adds add_gui_element to Gui.<commit_after>import pygame

LEFT = 1

class Gui:
    def __init__(self):
        self.gui_elements = list()

    def update(self, mouse, events):
        curr_element = None
        for element in self.gui_elements:
            if element.contains(mouse.get_pos):
                curr_element = element
                element.on_hover()

        if curr_element is not None:
            for event in events:
                # Check onMouseDown for left mouse button.
                if event.type == pygame.MOUSEBUTTONDOWN and event.button == LEFT:
                    curr_element.on_mouse_down()
                # Check onMouseUp for left mouse button.
                elif event.type == pygame.MOUSEBUTTONUP and event.button == LEFT:
                    curr_element.on_mouse_up()

        curr_element = None

    def add_gui_element(self, gui_element):
        self.gui_elements.append(gui_element)
{'fraction_non_alphanumeric': 0.07102272727272728, 'fraction_numerical': 0.0011363636363636363, 'mean_word_length': 1.8221153846153846, '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': '3896532', 'n_tokens_mistral': 491, 'n_tokens_neox': 471, 'n_words': 130}