<commit_before>#!/usr/bin/env python
#coding=utf8
'''
Write to stdin to serial
'''

import logging
logger = logging.getLogger(__name__)
import random
import operator
import threading
import itertools

from multiprocessing import Process, Pipe

try:
    import serial
except ImportError:
    logger.warn("Unable to load PySerial. No Arduino output available.")
    raise

class SyncArduino:
    def __init__(self, port='COM7', baud=115200, timeout=1):
        self.connection = serial.Serial(port, baud, timeout=timeout)

    def move_mouse(self, x, y):
        move_mouse(int(x), int(y), self.connection)


def get_serial_link(port, baud, timeout=1, fps=30, slices=3, async=False):
    if async is False:
        return SyncArduino(port, baud, timeout)
    else:
        return AsyncArduino(port, baud, timeout, fps, slices)


def child_process_event_loop(conn, fps, slices, port, baud, timeout=1):
    serial_handle = serial.Serial(port, baud, timeout=timeout)
    while conn.poll(3):
        try:
            x, y, port, baud = conn.recv()
            move_mouse_interp(x,y, fps, slices, serial_handle)
        except Exception as e:
            h = open('./templog', 'a')
            h.write(e)


def move_mouse(x, y, handle):
    try:
        command = "32100\n%d\n%d\n" % (int(x),int(y))
        handle.write(command)
        f = '/Users/carl/sandbox/headmouse/python/headmouse/templog'
        s = "move %s,%s\n\n" % (x, y)
        h = open(f, 'a')
        h.write(s)
    except Exception as e:
        h = open(f, 'a')
        h.write('e')

def delta_slice(delta, slice_quantity):
<commit_msg>Remove debugging stuff in arduino_serial<commit_after>#!/usr/bin/env python
#coding=utf8
'''
Write to stdin to serial
'''

import logging
logger = logging.getLogger(__name__)
import random
import operator
import threading
import itertools

from multiprocessing import Process, Pipe

try:
    import serial
except ImportError:
    logger.warn("Unable to load PySerial. No Arduino output available.")
    raise

class SyncArduino:
    def __init__(self, port='COM7', baud=115200, timeout=1):
        self.connection = serial.Serial(port, baud, timeout=timeout)

    def move_mouse(self, x, y):
        move_mouse(int(x), int(y), self.connection)


def get_serial_link(port, baud, timeout=1, fps=30, slices=3, async=False):
    if async is False:
        return SyncArduino(port, baud, timeout)
    else:
        return AsyncArduino(port, baud, timeout, fps, slices)


def child_process_event_loop(conn, fps, slices, port, baud, timeout=1):
    serial_handle = serial.Serial(port, baud, timeout=timeout)
    while conn.poll(3):
        try:
            x, y, port, baud = conn.recv()
            move_mouse_interp(x,y, fps, slices, serial_handle)
        except Exception as e:
            pass


def move_mouse(x, y, handle):
    try:
        command = "32100\n%d\n%d\n" % (int(x),int(y))
        handle.write(command)
    except Exception as e:
        pass

def delta_slice(delta, slice_quantity):

{'fraction_non_alphanumeric': 0.12041360907271514, 'fraction_numerical': 0.0133422281521014, 'mean_word_length': 3.165277777777778, 'pattern_counts': {'":': 0, '<': 3, '<?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': '6325516', 'n_tokens_mistral': 1051, 'n_tokens_neox': 1002, 'n_words': 269}