From 2696b7bc1b3c64ecdc161acd104978a8a648c376 Mon Sep 17 00:00:00 2001 From: Olivier Gayot Date: Mon, 8 Nov 2021 17:48:40 +0100 Subject: Use a nested function instead of a lambda to exit Signed-off-by: Olivier Gayot --- pycameltris/screens/Pause.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'pycameltris/screens/Pause.py') diff --git a/pycameltris/screens/Pause.py b/pycameltris/screens/Pause.py index baca5ca..1502be7 100644 --- a/pycameltris/screens/Pause.py +++ b/pycameltris/screens/Pause.py @@ -1,5 +1,6 @@ import contextlib import sys +from typing import NoReturn import pygame @@ -17,7 +18,10 @@ class Pause(Screen): def __init__(self, screen): self.event_handler = dict() - self.event_handler[pygame.QUIT] = lambda _: sys.exit() + def exit(_) -> NoReturn: + sys.exit() + + self.event_handler[pygame.QUIT] = exit self.event_handler[pygame.JOYBUTTONDOWN] = lambda evt: handle_input_pressed(JoystickController(evt.joy), evt) self.event_handler[pygame.KEYDOWN] = lambda evt: handle_input_pressed(KeyboardController(pygame.key), evt) -- cgit v1.2.3