<commit_before># -*- coding: utf-8 -*-
"""
Created on Sat Sep 10 15:25:02 2016

@author: jessime
"""

import pygame
import events

class Controller():
    def __init__(self, ev_manager, model):
        self.ev_manager = ev_manager
        self.model = model

        self.ev_manager.register(self)
        self.key_event_checks = [self.check_others]

    def check_others(self, message, event):
        if event.key == pygame.K_ESCAPE:
            message = events.UserQuit()
        elif event.key == pygame.K_f:
            message = events.Flip('l')
        elif event.key == pygame.K_j:
            message = events.Flip('r')
        return message

    def notify(self, event):
        if isinstance(event, events.LoopEnd):
            for pygame_event in pygame.event.get():
                message = None
                if pygame_event.type == pygame.KEYUP:
                    for func in self.key_event_checks:
                        message = func(message, pygame_event)
                        if message:
                            self.ev_manager.post(message)
                            break<commit_msg>Exit button works!<commit_after># -*- coding: utf-8 -*-
"""
Created on Sat Sep 10 15:25:02 2016

@author: jessime
"""

import pygame
import events

class Controller():
    def __init__(self, ev_manager, model):
        self.ev_manager = ev_manager
        self.model = model

        self.ev_manager.register(self)
        self.key_event_checks = [self.check_others]

    def check_others(self, message, event):
        if event.key == pygame.K_ESCAPE:
            message = events.UserQuit()
        elif event.key == pygame.K_f:
            message = events.Flip('l')
        elif event.key == pygame.K_j:
            message = events.Flip('r')
        return message

    def notify(self, event):
        if isinstance(event, events.LoopEnd):
            for pygame_event in pygame.event.get():
                message = None
                if pygame_event.type == pygame.KEYUP:
                    for func in self.key_event_checks:
                        message = func(message, pygame_event)
                elif pygame_event.type == pygame.QUIT:
                    message = events.UserQuit()
                if message:
                    self.ev_manager.post(message)
                    break
{'fraction_non_alphanumeric': 0.09879725085910653, 'fraction_numerical': 0.011168384879725086, 'mean_word_length': 1.736780258519389, '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': '1661004', 'n_tokens_mistral': 696, 'n_tokens_neox': 651, 'n_words': 158}