<commit_before>#!/usr/bin/env python

"""Contains the CAN class for interacting with vector hardware."""

# pylint: disable=W0223, R0911, C0103
import traceback
import time
import logging
import os
import math
import sys
import inspect
import socket
import select
import shlex
from re import findall
from argparse import ArgumentParser
from threading import Thread, Event
from ctypes import cdll, CDLL, c_uint, c_int, c_ubyte, c_ulong, cast
from ctypes import c_ushort, c_ulonglong, pointer, sizeof, POINTER
from ctypes import c_short, c_long, create_string_buffer
from ctypes import WinDLL, c_char_p
from binascii import unhexlify, hexlify
from fractions import gcd
from pyvxl import pydbc, settings, config
from pyvxl.vector_data_types import event, driverConfig
from colorama import init, deinit, Fore, Back, Style
if os.name == 'nt':
    from win32event import CreateEvent  # pylint: disable=E0611


# Grab the c library and some functions from it
if os.name == 'nt':
    libc = cdll.msvcrt
else:
    libc = CDLL("libc.so.6")
printf = libc.printf
strncpy = libc.strncpy
memset = libc.memset
memcpy = libc.memcpy

# Import the vector DLL
if os.name == 'nt':
    try:
        vxDLL = WinDLL("c:\\Users\\Public\\Documents\\Vector XL Driver Library\\bin\\vxlapi.dll")
    except WindowsError:
        vxDLL = WinDLL("c:\\Users\\Public\\Documents\\Vector XL Driver Library\\bin\\vxlapi64.dll")

# Redefine dll functions
openDriver = vxDLL.xlOpenDriver
closeDriver = vxDLL.xlCloseDriver
openPort = vxDLL.xlOpenPort
closePort = vxDLL.xlClosePort
transmitMsg = vxDLL.xlCanTransmit
receiveMsg = vxDLL.xlReceive
getError = vxDLL.xlGetErrorString
getError.restype = c_char_p
getDriverConfig = vxDLL.xlGetDriverConfig
setBaudrate = vxDLL.xlCanSetChannelBitrate
activateChannel = vxDLL.xlActivateChannel
flushTxQueue = vxDLL.xlCanFlushTransmitQueue
flushRxQueue = vxDLL.xlFlushReceiveQueue
resetClock = vxDLL.xlResetClock
setNotification = vxDLL.xlSetNotification
deactivateChannel = vxDLL.xlDeactivateChannel
setChannelTransceiver = vxDLL.xlCanSetChannelTransceiver
getEventStr = vxDLL.xlGetEventString
getEventStr.restype = c_char_p

class messageToFind(object):
    """Helper class for the receive thread."""

    def __init__(self, msgID, data, mask):
        """."""
        self.msgID = msgID
        self.data = data
        self.mask = mask
        self.rxFrames = []

    def getFirstMessage(self):
        """ Returns the first found message """
        resp = None
        if self.rxFrames:
            resp = self.rxFrames[0]
            self.rxFrames = self.rxFrames[1:]
        return resp
<commit_msg>More whitespace!<commit_after>#!/usr/bin/env python

"""Contains the CAN class for interacting with vector hardware."""

# pylint: disable=W0223, R0911, C0103
import traceback
import time
import logging
import os
import math
import sys
import inspect
import socket
import select
import shlex
from re import findall
from argparse import ArgumentParser
from threading import Thread, Event
from ctypes import cdll, CDLL, c_uint, c_int, c_ubyte, c_ulong, cast
from ctypes import c_ushort, c_ulonglong, pointer, sizeof, POINTER
from ctypes import c_short, c_long, create_string_buffer
from ctypes import WinDLL, c_char_p
from binascii import unhexlify, hexlify
from fractions import gcd
from pyvxl import pydbc, settings, config
from pyvxl.vector_data_types import event, driverConfig
from colorama import init, deinit, Fore, Back, Style
if os.name == 'nt':
    from win32event import CreateEvent  # pylint: disable=E0611


# Grab the c library and some functions from it
if os.name == 'nt':
    libc = cdll.msvcrt
else:
    libc = CDLL("libc.so.6")
printf = libc.printf
strncpy = libc.strncpy
memset = libc.memset
memcpy = libc.memcpy

# Import the vector DLL
if os.name == 'nt':
    try:
        vxDLL = WinDLL("c:\\Users\\Public\\Documents\\Vector XL Driver Library\\bin\\vxlapi.dll")
    except WindowsError:
        vxDLL = WinDLL("c:\\Users\\Public\\Documents\\Vector XL Driver Library\\bin\\vxlapi64.dll")

# Redefine dll functions
openDriver = vxDLL.xlOpenDriver
closeDriver = vxDLL.xlCloseDriver
openPort = vxDLL.xlOpenPort
closePort = vxDLL.xlClosePort
transmitMsg = vxDLL.xlCanTransmit
receiveMsg = vxDLL.xlReceive
getError = vxDLL.xlGetErrorString
getError.restype = c_char_p
getDriverConfig = vxDLL.xlGetDriverConfig
setBaudrate = vxDLL.xlCanSetChannelBitrate
activateChannel = vxDLL.xlActivateChannel
flushTxQueue = vxDLL.xlCanFlushTransmitQueue
flushRxQueue = vxDLL.xlFlushReceiveQueue
resetClock = vxDLL.xlResetClock
setNotification = vxDLL.xlSetNotification
deactivateChannel = vxDLL.xlDeactivateChannel
setChannelTransceiver = vxDLL.xlCanSetChannelTransceiver
getEventStr = vxDLL.xlGetEventString
getEventStr.restype = c_char_p


class messageToFind(object):
    """Helper class for the receive thread."""

    def __init__(self, msgID, data, mask):
        """."""
        self.msgID = msgID
        self.data = data
        self.mask = mask
        self.rxFrames = []

    def getFirstMessage(self):
        """ Returns the first found message """
        resp = None
        if self.rxFrames:
            resp = self.rxFrames[0]
            self.rxFrames = self.rxFrames[1:]
        return resp

{'fraction_non_alphanumeric': 0.08374856266768876, 'fraction_numerical': 0.008815638175546186, 'mean_word_length': 4.131760078662733, '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': '7206726', 'n_tokens_mistral': 1729, 'n_tokens_neox': 1641, 'n_words': 475}