<commit_before>from . import Control, UI, Macros
from typing import Dict, Text, Any, List, Tuple, Callable, Union, NewType
import os
import threading
from toolz.curried import curry, get
import appJar as aj
from math import ceil
import PyCmdMessenger as cmd
import configparser
import asyncio as aio



def readConfig(configFile: Text = "./.config") -> Dict[Text, Any]:
    """
    Reads a configuration file.
    """
    config = configparser.ConfigParser()
    config.read(configFile)
    settings = dict()
    settings["SerialPort"] = config["DEFAULT"]["SerialPort"]
    settings["PollTime"] = int(config["DEFAULT"]["PollTime"])
    settings["BaudRate"] = int(config["DEFAULT"]["BaudRate"])
    return settings


def motorStatusMonitor(app: aj.appjar.gui, Messenger: cmd.PyCmdMessenger.CmdMessenger)-> Callable:
    def getStatus():
        nonlocal Messenger
        nonlocal app
        # Ask for the current status of the motor
        t = await Control.sendCommand(Messenger, "Status")
        d = {t[1][0]: t[1][1], t[1][2]: t[1][3]}  # parse the response
        def statusChanger():  # need a closure to write to the app when called
            nonlocal d  # use the message from above
            nonlocal app  # use the app passed with motorStatusMonitor
            app.openTab("Main", "Control")
            app.openLabelFrame("Status")
            app.setLabel("motorStatus", f"Motor A: \t\t {get('A', d, '???')}\nMotor B: \t\t {get('B', d, '???')}") # Print the status of the motors to the app
        return statusChanger

    return getStatus()



def demo(board: cmd.arduino.ArduinoBoard, Messenger: cmd.PyCmdMessenger.CmdMessenger, *rest, MotorDefaultTime=1000, fullscreen=False) -> None:
    """Demo"""

    app = UI.makeUI(size=(720, 480))<commit_msg>One tiny fix<commit_after>from . import Control, UI, Macros
from typing import Dict, Text, Any, List, Tuple, Callable, Union, NewType
import os
import threading
from toolz.curried import curry, get
import appJar as aj
from math import ceil
import PyCmdMessenger as cmd
import configparser
import asyncio as aio



def readConfig(configFile: Text = "./.config") -> Dict[Text, Any]:
    """
    Reads a configuration file.
    """
    config = configparser.ConfigParser()
    config.read(configFile)
    settings = dict()
    settings["SerialPort"] = config["DEFAULT"]["SerialPort"]
    settings["PollTime"] = int(config["DEFAULT"]["PollTime"])
    settings["BaudRate"] = int(config["DEFAULT"]["BaudRate"])
    return settings


def motorStatusMonitor(app: aj.appjar.gui, Messenger: cmd.PyCmdMessenger.CmdMessenger)-> Callable:
    def getStatus():
        nonlocal Messenger
        nonlocal app
        # Ask for the current status of the motor
        t = Control.sendCommand(Messenger, "Status")
        d = {t[1][0]: t[1][1], t[1][2]: t[1][3]}  # parse the response
        def statusChanger():  # need a closure to write to the app when called
            nonlocal d  # use the message from above
            nonlocal app  # use the app passed with motorStatusMonitor
            app.openTab("Main", "Control")
            app.openLabelFrame("Status")
            app.setLabel("motorStatus", f"Motor A: \t\t {get('A', d, '???')}\nMotor B: \t\t {get('B', d, '???')}") # Print the status of the motors to the app
        return statusChanger

    return getStatus()



def demo(board: cmd.arduino.ArduinoBoard, Messenger: cmd.PyCmdMessenger.CmdMessenger, *rest, MotorDefaultTime=1000, fullscreen=False) -> None:
    """Demo"""

    app = UI.makeUI(size=(720, 480))
{'fraction_non_alphanumeric': 0.13054535179429216, 'fraction_numerical': 0.010172365074879909, 'mean_word_length': 3.4139650872817957, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '4480723', 'n_tokens_mistral': 1120, 'n_tokens_neox': 1063, 'n_words': 330}