<commit_before>import commands
import ConfigParser
import serial
import sys
import time

class PushToTalk(object):

    def __init__(self):
        self.portdefault = None
        self.port = None

        self.conf = ConfigParser.ConfigParser()
        self.path = "configuration/general.config"
        self.conf.read(self.path)
        self.portdefault = self.conf.get("general", "serialport")

    def __del__(self):
        if (self.port):
            self.port.close()

    def openport(self):
        try:
            self.port = serial.Serial(self.portdefault, baudrate=115200, timeout=3.0)
            self.port.write("\r\nLet's push the PTT")
            self.port.write("Confirm PTT")
            self.port.flush()
        except:
            pass

    def closeport(self):
        try:
            self.port.close()
        except:
            pass

    def message(self, msg):

        self.openport()
        status, output = commands.getstatusoutput(msg)
        self.closeport()

if __name__ == "__main__":
    mytest = PushToTalk()<commit_msg>Core: IRLP Push To Talk<commit_after>import commands
import ConfigParser
import serial
import sys
import time

class PushToTalk(object):

    def __init__(self):
        self.portdefault = None
        self.port = None

        self.conf = ConfigParser.ConfigParser()
        self.path = "configuration/general.config"
        self.conf.read(self.path)
        self.portdefault = self.conf.get("general", "serialport")

    def __del__(self):
        if (self.port):
            self.port.close()

    def openport(self):
        try:
            commands.getstatusoutput("/home/irlp/bin/coscheck")
            commands.getstatusoutput("/home/irlp/scripts/off")
            commands.getstatusoutput("/home/irlp/bin/forcekey")
            self.port = serial.Serial(self.portdefault, baudrate=115200, timeout=3.0)
            self.port.write("\r\nLet's push the PTT")
            self.port.write("Confirm PTT")
            self.port.flush()
        except:
            pass

    def closeport(self):
        try:
            commands.getstatusoutput("/home/irlp/bin/forceunkey")
            self.port.close()
        except:
            pass

    def message(self, msg):

        self.openport()
        status, output = commands.getstatusoutput(msg)
        self.closeport()

if __name__ == "__main__":
    mytest = PushToTalk()
{'fraction_non_alphanumeric': 0.11436950146627566, 'fraction_numerical': 0.006702974444909929, 'mean_word_length': 2.0892626131953427, 'pattern_counts': {'":': 2, '<': 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': '1955030', 'n_tokens_mistral': 721, 'n_tokens_neox': 691, 'n_words': 139}