<commit_before># Enttec USB DMX Pro control interface
# Written by <NAME> <<EMAIL>>
# Based on the API documented in http://www.enttec.com/docs/dmx_usb_pro_api_spec.pdf
# This library  is available under the MIT license found in the LICENCE file

import sys
import serial
try:
	import serial.tools
	import serial.tools.list_ports
	serial_tools_avail = True
except ImportError:
	serial_tools_avail = False
import struct
import threading
import time
import binascii
import traceback

class EnttecUsbDmxPro:
# Constructor, destructors and globals
    def __init__(self):
        self.serial = serial.Serial()
        self.debug = {'SerialBuffer':False, 'RXWarning':False}
        self.widget = {'SerialNumber':0x0FFFFFFFF, 'UserParameters':{'FirmwareVersion':[0,0], 'DMXBreak':96, 'DMXMarkAfterBreak':10, 'DMXRate':40}} # Initialize the register. Note that DMXOutBreak and DMXMarkAfterBreak are in 10.67us units
        self.widget_event = {'SerialNumber':threading.Event(), 'UserParameters':threading.Event(), 'ThreadExit':threading.Event()} # Initialize the data requests variable
        self.serial.port = ""
        self.dmxRX = {"status":0,"frame":[]}
        if sys.version_info > (3,0):
            self.py2 = False
        else:
            self.py2 = True
    def setPort(self,port,baud=57600):
        self.serial.port = port
        self.serial.baudrate = baud
    def getPort(self):
        return self.serial.port
    def setDebug(mode,value):
        self.debug[mode] = value
    def getDebug(mode="all"):
        if mode == "all":
            return self.debug
        else:
            return self.debug[mode]

# Port control
    def connect(self):
        # Open and connect to the serial port
        if self.serial.isOpen():
            print(serial)
            disconnect()
        print("Opening Enttec USB DMX Pro on",self.serial.port,"at",self.serial.baudrate,"baud")
        self.serial.open()
        self.widget_event['ThreadExit'].clear()
        self.thread_read = threading.Thread(target=self.reader)
        self.thread_read.setDaemon(True)
        self.thread_read.setName("EnttecUsbDmxPro Reader on "+self.serial.port)
        self.thread_read.start()
        print("Open successful!")
    def open(self, baud=57600): # 
        self.connect(baud)
    def isOpen(self):
        return self.serial.isOpen()
    def list(self):
        print(serial.tools.list_ports.comports())
    def disconnect(self):
        # Disconnects from the serial port and closes read thread<commit_msg>Actually used serial tools detection algorithm On branch master Your branch is up-to-date with 'origin/master'. Changes to be committed: 	modified:   EnttecUsbDmxPro.py<commit_after># Enttec USB DMX Pro control interface
# Written by <NAME> <<EMAIL>>
# Based on the API documented in http://www.enttec.com/docs/dmx_usb_pro_api_spec.pdf
# This library  is available under the MIT license found in the LICENCE file

import sys
import serial
try:
	import serial.tools
	import serial.tools.list_ports
	serial_tools_avail = True
except ImportError:
	serial_tools_avail = False
import struct
import threading
import time
import binascii
import traceback

class EnttecUsbDmxPro:
# Constructor, destructors and globals
    def __init__(self):
        self.serial = serial.Serial()
        self.debug = {'SerialBuffer':False, 'RXWarning':False}
        self.widget = {'SerialNumber':0x0FFFFFFFF, 'UserParameters':{'FirmwareVersion':[0,0], 'DMXBreak':96, 'DMXMarkAfterBreak':10, 'DMXRate':40}} # Initialize the register. Note that DMXOutBreak and DMXMarkAfterBreak are in 10.67us units
        self.widget_event = {'SerialNumber':threading.Event(), 'UserParameters':threading.Event(), 'ThreadExit':threading.Event()} # Initialize the data requests variable
        self.serial.port = ""
        self.dmxRX = {"status":0,"frame":[]}
        if sys.version_info > (3,0):
            self.py2 = False
        else:
            self.py2 = True
    def setPort(self,port,baud=57600):
        self.serial.port = port
        self.serial.baudrate = baud
    def getPort(self):
        return self.serial.port
    def setDebug(mode,value):
        self.debug[mode] = value
    def getDebug(mode="all"):
        if mode == "all":
            return self.debug
        else:
            return self.debug[mode]

# Port control
    def connect(self):
        # Open and connect to the serial port
        if self.serial.isOpen():
            print(serial)
            disconnect()
        print("Opening Enttec USB DMX Pro on",self.serial.port,"at",self.serial.baudrate,"baud")
        self.serial.open()
        self.widget_event['ThreadExit'].clear()
        self.thread_read = threading.Thread(target=self.reader)
        self.thread_read.setDaemon(True)
        self.thread_read.setName("EnttecUsbDmxPro Reader on "+self.serial.port)
        self.thread_read.start()
        print("Open successful!")
    def open(self, baud=57600): # 
        self.connect(baud)
    def isOpen(self):
        return self.serial.isOpen()
    def list(self):
        if serial_tools_avail:
            print(serial.tools.list_ports.comports())
        else:
            raise RuntimeError("Serial Tools is not available")
    def disconnect(self):
        # Disconnects from the serial port and closes read thread
{'fraction_non_alphanumeric': 0.10873676248108925, 'fraction_numerical': 0.01096822995461422, 'mean_word_length': 3.043577981651376, 'pattern_counts': {'":': 6, '<': 9, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, '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': '1954403', 'n_tokens_mistral': 1618, 'n_tokens_neox': 1571, 'n_words': 400}