# Path: src/keylog.py
# class Keyboard(enum.Enum):
# class KeyLog:
#     def __init__(self, logging_delay=0.3):
#     def start(self):
#     def on_press(self, key):
#     def on_release(self, key):
#     def record(self):
#     def save_to_file(self, file_name="log.json"):
#     def _get_key_value(key):


import logging
import pickle
import re
import os
import random
import torch
from src import keylog
        image_single_channel = image
    except TypeError:
        logger.warning("Image key not generated.")
        return None
    return tuple(image_single_channel.flatten())


def get_tensor(image):
    try:
        image_single_channel = image[:, :, 1]
    except IndexError:
        image_single_channel = image
    except TypeError:
        logger.warning("Image tensor not generated.")
        return None
    return torch.from_numpy(image_single_channel).contiguous()


def get_output_vector(presses):
    out = []
    for key in keylog.Keyboard:
        out.append(presses.get(key.name, 0))
    return torch.FloatTensor(out)


def get_key_state_from_vector(vector):
    key_state = dict()
    # transpose to column vector
    n, d = vector.size()
    vector = vector.view(d, n)

# Path: src/keylog.py
# class Keyboard(enum.Enum):
# class KeyLog:
#     def __init__(self, logging_delay=0.3):
#     def start(self):
#     def on_press(self, key):
#     def on_release(self, key):
#     def record(self):
#     def save_to_file(self, file_name="log.json"):
#     def _get_key_value(key):


# Path: src/helper.py
import logging
import pickle
import re
import os
import random
import torch
from src import keylog

        image_single_channel = image
    except TypeError:
        logger.warning("Image key not generated.")
        return None
    return tuple(image_single_channel.flatten())


def get_tensor(image):
    try:
        image_single_channel = image[:, :, 1]
    except IndexError:
        image_single_channel = image
    except TypeError:
        logger.warning("Image tensor not generated.")
        return None
    return torch.from_numpy(image_single_channel).contiguous()


def get_output_vector(presses):
    out = []
    for key in keylog.Keyboard:
        out.append(presses.get(key.name, 0))
    return torch.FloatTensor(out)


def get_key_state_from_vector(vector):
    key_state = dict()
    # transpose to column vector
    n, d = vector.size()
    vector = vector.view(d, n)

    for i, key in enumerate(keylog.Keyboard):