<commit_before>#!/usr/bin/python2

import Leap, sys, re
from getopt import getopt
from phue import Bridge

config = {}

class LeapListener(Leap.Listener):
    def __init__(self, onXYZChange=None):
        super(self.__class__, self).__init__()
        self.onXYZChange = onXYZChange
        self.collectedFrames = 0
        self.framesBufferSize = 1

    def on_init(self, controller):
        print "Leap Motion initialized"

    def on_connect(self, controller):
        print "Leap Motion connected"

    def on_disconnect(self, controller):
        print "Leap Motion disconnected"

    def on_exit(self, controller):
        print "Leap Motion exited"

    def on_frame(self, controller):
        # React after X frames, to prevent flooding the Hue bridge
        if self.collectedFrames < self.framesBufferSize:
            self.collectedFrames += 1
            return

        self.collectedFrames = 0
        frame = controller.frame()

        for hand in frame.hands:
            posX = hand.palm_position[0]
            posY = hand.palm_position[1]
            posZ = hand.palm_position[2]<commit_msg>Throttling the traffic to Hue so that sampling(leap) = 3*sampling(hue)<commit_after>#!/usr/bin/python2

import Leap, sys, re
from getopt import getopt
from phue import Bridge

config = {}

class LeapListener(Leap.Listener):
    def __init__(self, onXYZChange=None):
        super(self.__class__, self).__init__()
        self.onXYZChange = onXYZChange
        self.collectedFrames = 0
        self.framesBufferSize = 3

    def on_init(self, controller):
        print "Leap Motion initialized"

    def on_connect(self, controller):
        print "Leap Motion connected"

    def on_disconnect(self, controller):
        print "Leap Motion disconnected"

    def on_exit(self, controller):
        print "Leap Motion exited"

    def on_frame(self, controller):
        # React after X frames, to prevent flooding the Hue bridge
        if self.collectedFrames < self.framesBufferSize:
            self.collectedFrames += 1
            return

        self.collectedFrames = 0
        frame = controller.frame()

        for hand in frame.hands:
            posX = hand.palm_position[0]
            posY = hand.palm_position[1]
            posZ = hand.palm_position[2]
{'fraction_non_alphanumeric': 0.08329679964927664, 'fraction_numerical': 0.007452871547566856, 'mean_word_length': 2.554517133956386, 'pattern_counts': {'":': 0, '<': 5, '<?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': '703376', 'n_tokens_mistral': 706, 'n_tokens_neox': 655, 'n_words': 183}