<commit_before>import serial

class LCDInterface():

    def __init__(self, operation_mode="hardware"):

        if (self.operation_mode == "hardware"):
            self.lcdCom = serial.Serial(
                    port="/dev/serial0",
                    baudrate=9600,
                    parity=serial.PARITY_NONE,
                    stopbits=serial.STOPBITS_ONE,
                    bytesize=serial.EIGHTBITS,
                    timeout=1
                )
    
    def display(self, first_line, second_line):
        if len(first_line) > 16:
            raise ValueError("First line of text can not be more than 16 characters")
        if len(second_line) > 16:
            raise ValueError("Second line of text can not be more than 16 characters")

        if (self.operation_mode=="hardware"):
            self.lcdCom.write(b"\xFE\x01")
            self.lcdCom.write(bytes(first_line, "ASCII"))
            self.lcdCom.write(bytes(second_line, "ASCII"))
        else:
            print(first_line)
            print(second_line)

    def clear(self):
        if (self.operation_mode == "hardware"):
            self.lcdCom.write(b"\xFE\x01")
            self.lcdCom.write(bytes("                ", "ASCII"))
            self.lcdCom.write(bytes("                ", "ASCII"))


    def close(self):
        if (self.operation_mode == "hardware"):
            self.lcdCom.close()<commit_msg>Added operation mode<commit_after>import serial

class LCDInterface():

    def __init__(self, operation_mode="hardware"):
        self.operation_mode = operation_mode
        if (self.operation_mode == "hardware"):
            self.lcdCom = serial.Serial(
                    port="/dev/serial0",
                    baudrate=9600,
                    parity=serial.PARITY_NONE,
                    stopbits=serial.STOPBITS_ONE,
                    bytesize=serial.EIGHTBITS,
                    timeout=1
                )
    
    def display(self, first_line, second_line):
        if len(first_line) > 16:
            raise ValueError("First line of text can not be more than 16 characters")
        if len(second_line) > 16:
            raise ValueError("Second line of text can not be more than 16 characters")

        if (self.operation_mode=="hardware"):
            self.lcdCom.write(b"\xFE\x01")
            self.lcdCom.write(bytes(first_line, "ASCII"))
            self.lcdCom.write(bytes(second_line, "ASCII"))
        else:
            print(first_line)
            print(second_line)

    def clear(self):
        if (self.operation_mode == "hardware"):
            self.lcdCom.write(b"\xFE\x01")
            self.lcdCom.write(bytes("                ", "ASCII"))
            self.lcdCom.write(bytes("                ", "ASCII"))


    def close(self):
        if (self.operation_mode == "hardware"):
            self.lcdCom.close()
{'fraction_non_alphanumeric': 0.11326064016883573, 'fraction_numerical': 0.01266268026732325, 'mean_word_length': 1.755813953488372, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '4354373', 'n_tokens_mistral': 847, 'n_tokens_neox': 809, 'n_words': 159}