from time import time


class DataGruber():
    def __init__(self, max_gesture_duration_time=3):
        self.max_gesture_duration_time = max_gesture_duration_time
        self.gestures_list = []
        self.time_list = []

    def update_gestures_list(self, gesture):
        actual_time = time()
        self.gestures_list.append(gesture)
        self.time_list.append(actual_time)
        for i, t in enumerate(self.time_list):
            if actual_time - t >= self.max_gesture_duration_time:
                self.time_list.pop(i)
                self.gestures_list.pop(i)

    def get_actual_gestures_sequence(self):
        return self.gestures_list
