<commit_before>#!/usr/bin/python

import sys
import os
import fileinput
import serial
import struct
import time

class PortTalker(object):
    def __init__(self, port):
        self.sp = serial.Serial(port, 57600)
        self.sp.setTimeout(0.02)
        self.buff = ''

    def send_picture(self, half, data):
        assert half in [0, 1]
        assert len(data) == 28
        l_bytes = [0x80, 0x83, half] + data + [0x8F]
        packed = struct.pack('32B', *l_bytes)
        self.sp.write(packed)

def make_data(filename):
    # input is a 28 line x 14 column text file consisting of spaces and x
    # output is { 0: [ length 14 list of ints ], 1: [ same ] }
    
    d = {0: [], 1: []}
    count = 0
    for line in open(filename).readlines():
        count += 1
        if count > 28: 
            break
        line = line.replace('.', '0')
        line = line.replace('x', '1')
        bottom = line[0:7]
        top = line[7:14]
            
        d[0].append(int(top,2))<commit_msg>fix comment - we use dots not spaces<commit_after>#!/usr/bin/python

import sys
import os
import fileinput
import serial
import struct
import time

class PortTalker(object):
    def __init__(self, port):
        self.sp = serial.Serial(port, 57600)
        self.sp.setTimeout(0.02)
        self.buff = ''

    def send_picture(self, half, data):
        assert half in [0, 1]
        assert len(data) == 28
        l_bytes = [0x80, 0x83, half] + data + [0x8F]
        packed = struct.pack('32B', *l_bytes)
        self.sp.write(packed)

def make_data(filename):
    # input is a 28 line x 14 column text file consisting of '.' and 'x' characters
    # output is { 0: [ length 14 list of ints ], 1: [ same ] }
    
    d = {0: [], 1: []}
    count = 0
    for line in open(filename).readlines():
        count += 1
        if count > 28: 
            break
        line = line.replace('.', '0')
        line = line.replace('x', '1')
        bottom = line[0:7]
        top = line[7:14]
            
        d[0].append(int(top,2))
{'fraction_non_alphanumeric': 0.13445378151260504, 'fraction_numerical': 0.044488383588729606, 'mean_word_length': 2.080669710806697, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '6665794', 'n_tokens_mistral': 731, 'n_tokens_neox': 669, 'n_words': 201}