<filename>keyprocessor.py
import pygame

def getkey(key, shift: bool):
    if not shift:
        match key:
            case pygame.K_0:
                return '0'
            case pygame.K_1:
                return '1'
            case pygame.K_2:
                return '2'
            case pygame.K_3:
                return '3'
            case pygame.K_4:
                return '4'
            case pygame.K_5:
                return '5'
            case pygame.K_6:
                return '6'
            case pygame.K_7:
                return '7'
            case pygame.K_8:
                return '8'
            case pygame.K_9:
                return '9'
            case pygame.K_a:
                return 'a'
            case pygame.K_b:
                return 'b'
            case pygame.K_c:
                return 'c'
            case pygame.K_d:
                return 'd'
            case pygame.K_e:
                return 'e'
            case pygame.K_f:
                return 'f'
            case pygame.K_g:
                return 'g'
            case pygame.K_h:
                return 'h'
            case pygame.K_i:
                return 'i'
            case pygame.K_j:
                return 'j'
            case pygame.K_k:
                return 'k'
            case pygame.K_l:
                return 'l'
            case pygame.K_m:
                return 'm'
            case pygame.K_n:
                return 'n'
            case pygame.K_o:
                return 'o'
            case pygame.K_p:
                return 'p'
            case pygame.K_q:
                return 'q'
            case pygame.K_r:
                return 'r'
            case pygame.K_s:
                return 's'
            case pygame.K_t:
                return 't'
            case pygame.K_u:
                return 'u'
            case pygame.K_v:
                return 'v'
            case pygame.K_w:
                return 'w'
            case pygame.K_x:
                return 'x'
            case pygame.K_y:
                return 'y'
            case pygame.K_z:
                return 'z'
            case pygame.K_RETURN:
                return 'return'
            case pygame.K_SPACE:
                return ' '
            case pygame.K_BACKSPACE:
                return 'backspace'
            case pygame.K_PERIOD:
                return '.'
            case pygame.K_QUOTE:
                return "'"
            case pygame.K_SLASH:
                return '/'
            case pygame.K_BACKSLASH:
                return '\\'
            case pygame.K_SEMICOLON:
                return ';'
            case pygame.K_MINUS:
                return '-'
            case _:
                return ''
    elif shift:
        match key:
            case pygame.K_0:
                return ')'
            case pygame.K_1:
                return '!'
            case pygame.K_2:
                return '@'
            case pygame.K_3:
                return '#'
            case pygame.K_4:
                return '$'
            case pygame.K_5:
                return '%'
            case pygame.K_6:
                return '^'
            case pygame.K_7:
                return '&'
            case pygame.K_8:
                return '*'
            case pygame.K_9:
                return '('
            case pygame.K_a:
                return 'A'
            case pygame.K_b:
                return 'B'
            case pygame.K_c:
                return 'C'
            case pygame.K_d:
                return 'D'
            case pygame.K_e:
                return 'E'
            case pygame.K_f:
                return 'F'
            case pygame.K_g:
                return 'G'
            case pygame.K_h:
                return 'H'
            case pygame.K_i:
                return 'I'
            case pygame.K_j:
                return 'J'
            case pygame.K_k:
                return 'K'
            case pygame.K_l:
                return 'L'
            case pygame.K_m:
                return 'M'
            case pygame.K_n:
                return 'N'
            case pygame.K_o:
                return 'O'
            case pygame.K_p:
                return 'P'
            case pygame.K_q:
                return 'Q'
            case pygame.K_r:
                return 'R'
            case pygame.K_s:
                return 'S'
            case pygame.K_t:
                return 'T'
            case pygame.K_u:
                return 'U'
            case pygame.K_v:
                return 'V'
            case pygame.K_w:
                return 'W'
            case pygame.K_x:
                return 'X'
            case pygame.K_y:
                return 'Y'
            case pygame.K_z:
                return 'Z'
            case pygame.K_RETURN:
                return 'return'
            case pygame.K_SPACE:
                return ' '
            case pygame.K_BACKSPACE:
                return 'backspace'
            case pygame.K_PERIOD:
                return '.'
            case pygame.K_QUOTE:
                return '"'
            case pygame.K_SLASH:
                return '?'
            case pygame.K_BACKSLASH:
                return '|'
            case pygame.K_SEMICOLON:
                return ':'
            case pygame.K_MINUS:
                return '_'
            case _:
                return ''

<filename>keyprocessor.py
import pygame

def getkey(key, shift: bool):
    if not shift:
        match key:
            case pygame.K_0:
                return '0'
            case pygame.K_1:
                return '1'
            case pygame.K_2:
                return '2'
            case pygame.K_3:
                return '3'
            case pygame.K_4:
                return '4'
            case pygame.K_5:
                return '5'
            case pygame.K_6:
                return '6'
            case pygame.K_7:
                return '7'
            case pygame.K_8:
                return '8'
            case pygame.K_9:
                return '9'
            case pygame.K_a:
                return 'a'
            case pygame.K_b:
                return 'b'
            case pygame.K_c:
                return 'c'
            case pygame.K_d:
                return 'd'
            case pygame.K_e:
                return 'e'
            case pygame.K_f:
                return 'f'
            case pygame.K_g:
                return 'g'
            case pygame.K_h:
                return 'h'
            case pygame.K_i:
                return 'i'
            case pygame.K_j:
                return 'j'
            case pygame.K_k:
                return 'k'
            case pygame.K_l:
                return 'l'
            case pygame.K_m:
                return 'm'
            case pygame.K_n:
                return 'n'
            case pygame.K_o:
                return 'o'
            case pygame.K_p:
                return 'p'
            case pygame.K_q:
                return 'q'
            case pygame.K_r:
                return 'r'
            case pygame.K_s:
                return 's'
            case pygame.K_t:
                return 't'
            case pygame.K_u:
                return 'u'
            case pygame.K_v:
                return 'v'
            case pygame.K_w:
                return 'w'
            case pygame.K_x:
                return 'x'
            case pygame.K_y:
                return 'y'
            case pygame.K_z:
                return 'z'
            case pygame.K_RETURN:
                return 'return'
            case pygame.K_SPACE:
                return ' '
            case pygame.K_BACKSPACE:
                return 'backspace'
            case pygame.K_PERIOD:
                return '.'
            case pygame.K_QUOTE:
                return "'"
            case pygame.K_SLASH:
                return '/'
            case pygame.K_BACKSLASH:
                return '\\'
            case pygame.K_SEMICOLON:
                return ';'
            case pygame.K_MINUS:
                return '-'
            case _:
                return ''
    elif shift:
        match key:
            case pygame.K_0:
                return ')'
            case pygame.K_1:
                return '!'
            case pygame.K_2:
                return '@'
            case pygame.K_3:
                return '#'
            case pygame.K_4:
                return '$'
            case pygame.K_5:
                return '%'
            case pygame.K_6:
                return '^'
            case pygame.K_7:
                return '&'
            case pygame.K_8:
                return '*'
            case pygame.K_9:
                return '('
            case pygame.K_a:
                return 'A'
            case pygame.K_b:
                return 'B'
            case pygame.K_c:
                return 'C'
            case pygame.K_d:
                return 'D'
            case pygame.K_e:
                return 'E'
            case pygame.K_f:
                return 'F'
            case pygame.K_g:
                return 'G'
            case pygame.K_h:
                return 'H'
            case pygame.K_i:
                return 'I'
            case pygame.K_j:
                return 'J'
            case pygame.K_k:
                return 'K'
            case pygame.K_l:
                return 'L'
            case pygame.K_m:
                return 'M'
            case pygame.K_n:
                return 'N'
            case pygame.K_o:
                return 'O'
            case pygame.K_p:
                return 'P'
            case pygame.K_q:
                return 'Q'
            case pygame.K_r:
                return 'R'
            case pygame.K_s:
                return 'S'
            case pygame.K_t:
                return 'T'
            case pygame.K_u:
                return 'U'
            case pygame.K_v:
                return 'V'
            case pygame.K_w:
                return 'W'
            case pygame.K_x:
                return 'X'
            case pygame.K_y:
                return 'Y'
            case pygame.K_z:
                return 'Z'
            case pygame.K_RETURN:
                return 'return'
            case pygame.K_SPACE:
                return ' '
            case pygame.K_BACKSPACE:
                return 'backspace'
            case pygame.K_PERIOD:
                return '.'
            case pygame.K_QUOTE:
                return '"'
            case pygame.K_SLASH:
                return '?'
            case pygame.K_BACKSLASH:
                return '|'
            case pygame.K_SEMICOLON:
                return ':'
            case pygame.K_MINUS:
                return '_'
            case _:
                return ''
