<commit_before>import curses
import logging
logger = logging.getLogger(__name__)

from cobra.gamepad import GamePad
from cobra.screen import CursesScreen
from cobra.util import sleep


class MenuScreen(CursesScreen):

    START_GAME = 0
    HOW_TO = 1
    HISCORES = 2
    QUIT = 3

    def __init__(self, application):
        CursesScreen.__init__(self, application)

        self.logo = []
        self.menu_options = ["Start Game", "How-To", "High Scores", "Quit"]
        self.option = self.START_GAME

        self.create()

    def create(self):
        self._create_logo()

    def _create_logo(self):
        self.logo = [
            " ##############                                                             ",
            "################                                                            ",
            "###############                                                             ",
            "####                                                                        ",
            "###                ##########   ############   ############      ########   ",
            "###               ############  ############## ##############   ##########  ",
            "###              ####      #### ###        ### ###        ###  ###      ### ",
            "###              ###        ### ###        ### ###        ### ###        ###",
            "###              ###        ### ############   ############   ###        ###",
            "###              ###        ### ###        ### ###    ###     ##############",
            "####             ###        ### ###        ### ###     ###    ##############",
            "###############  ####      #### ###        ### ###      ###   ###        ###",
            "################  ############  ############## ###       ###  ###        ###",
            " ##############    ##########   ############   ###        ### ###        ###"
        ]

    def setup_gamepad(self):
        def up():
            self.option -= 1
            if self.option < self.START_GAME:
                self.option = self.START_GAME
        def down():
            self.option += 1
            if self.option > self.QUIT:
                self.option = self.QUIT
        def enter():
            if self.option == self.START_GAME:
                logger.info("Start game")
            elif self.option == self.HOW_TO:
                logger.info("How-To")
            elif self.option == self.HISCORES:
                logger.info("High scores")
            elif self.option == self.QUIT:
                self.application.exit()

        self.gamepad.commands[GamePad.UP] = up
        self.gamepad.commands[GamePad.DOWN] = down
        self.gamepad.commands[GamePad.ENTER] = enter

    def dispose(self):
        pass

    def update(self, delta):
        sleep()
        self.gamepad.process_input()

        self.stdscr.clear()
        self.stdscr.border()
        self._render_logo()
        self._render_menu()
        self.stdscr.refresh()

    def _render_logo(self):
        height, width = self.window_size
        y = 2<commit_msg>Organizando um pouco do código.<commit_after>import curses
import logging
logger = logging.getLogger(__name__)

from cobra.gamepad import GamePad
from cobra.screen import CursesScreen
from cobra.util import sleep


class MenuScreen(CursesScreen):

    START_GAME = 0
    HOW_TO = 1
    HISCORES = 2
    QUIT = 3

    def __init__(self, application):
        CursesScreen.__init__(self, application)

        self.logo = []
        self.menu_options = ["Start", "How-To", "High Scores", "Quit"]
        self.option = self.START_GAME

        self.create()

    def create(self):
        self._create_logo()

    def _create_logo(self):
        self.logo = [
            " ##############                                                             ",
            "################                                                            ",
            "###############                                                             ",
            "####                                                                        ",
            "###                ##########   ############   ############      ########   ",
            "###               ############  ############## ##############   ##########  ",
            "###              ####      #### ###        ### ###        ###  ###      ### ",
            "###              ###        ### ###        ### ###        ### ###        ###",
            "###              ###        ### ############   ############   ###        ###",
            "###              ###        ### ###        ### ###    ###     ##############",
            "####             ###        ### ###        ### ###     ###    ##############",
            "###############  ####      #### ###        ### ###      ###   ###        ###",
            "################  ############  ############## ###       ###  ###        ###",
            " ##############    ##########   ############   ###        ### ###        ###"
        ]

    def setup_gamepad(self):
        def up():
            self.option -= 1
            if self.option < self.START_GAME:
                self.option = self.START_GAME
        def down():
            self.option += 1
            if self.option > self.QUIT:
                self.option = self.QUIT
        def enter():
            if self.option == self.START_GAME:
                logger.info("Start game")
            elif self.option == self.HOW_TO:
                logger.info("How-To")
            elif self.option == self.HISCORES:
                logger.info("High scores")
            elif self.option == self.QUIT:
                self.application.exit()

        self.gamepad.commands[GamePad.UP] = up
        self.gamepad.commands[GamePad.DOWN] = down
        self.gamepad.commands[GamePad.ENTER] = enter

    def update(self, delta):
        sleep()
        self.gamepad.process_input()

        self._render()

    def _render(self):
        self.stdscr.clear()
        self.stdscr.border()
        self._render_logo()
        self._render_menu()
        self.stdscr.refresh()

    def _render_logo(self):
        height, width = self.window_size
        y = 2
{'fraction_non_alphanumeric': 0.2217942545337827, 'fraction_numerical': 0.0022468303643074948, 'mean_word_length': 1.16991643454039, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 26, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5962296', 'n_tokens_mistral': 1586, 'n_tokens_neox': 1518, 'n_words': 234}