<commit_before># Copyright (C) 2014 <NAME>
# For conditions of distribution and use, see copyright notice in the LICENSE file

from DistantIO.API.crc import crc16
from struct import pack,unpack

class distantio_protocol():
    def __init__(self,on_tx_frame_callback):
        self.variables = []
        self.on_tx_frame_callback = on_tx_frame_callback
        self.payload_size = 14
        self.format_lookup = {0 : '>xxxxf',
                              1 : '>xxxxxxxB',
                              2 : '>xxxxxxH',
                              3 : '>xxxxI',
                              4 : '>xxxxxxxb',
                              5 : '>xxxxxxh',
                              6 : '>xxxxi'}

    # Returns the get-descriptors frame
    def get_descriptors_frame(self):
        packet = bytearray(14)
        # Build data frame
        packet[0] = 0x02
        packet[4] = 0xFF
        packet[11] = 0xFF
        # Compute CRC
        crc = crc16(packet[:-2]).to_bytes(2,byteorder='big')
        packet[12] = crc[0]
        packet[13] = crc[1]
        return packet<commit_msg>Removed unused callback<commit_after># Copyright (C) 2014 <NAME>
# For conditions of distribution and use, see copyright notice in the LICENSE file

from DistantIO.API.crc import crc16
from struct import pack,unpack

class distantio_protocol():
    def __init__(self):
        self.variables = []
        self.payload_size = 14
        self.format_lookup = {0 : '>xxxxf',
                              1 : '>xxxxxxxB',
                              2 : '>xxxxxxH',
                              3 : '>xxxxI',
                              4 : '>xxxxxxxb',
                              5 : '>xxxxxxh',
                              6 : '>xxxxi'}

    # Returns the get-descriptors frame
    def get_descriptors_frame(self):
        packet = bytearray(14)
        # Build data frame
        packet[0] = 0x02
        packet[4] = 0xFF
        packet[11] = 0xFF
        # Compute CRC
        crc = crc16(packet[:-2]).to_bytes(2,byteorder='big')
        packet[12] = crc[0]
        packet[13] = crc[1]
        return packet
{'fraction_non_alphanumeric': 0.10218631178707224, 'fraction_numerical': 0.034220532319391636, 'mean_word_length': 1.56394640682095, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 4, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6056808', 'n_tokens_mistral': 661, 'n_tokens_neox': 616, 'n_words': 153}