<commit_before>__author__ = "auxiliary-character"
from wpilib.command import Command
from wpilib.timer import Timer
import wpilib
import csv

class RecordMacro(Command):
    """This records robot movements and writes them to a .csv file."""
    def __init__(self, robot, name):
        super().__init__()
        self.robot = robot
        self.setTimeout(15)
        self.name = name
        self.initTime = wpilib.Timer.getFPGATimestamp()

    def initialize(self):
        self.f = open("/home/lvuser/py/"+self.name, "w")
        fields = ["Drive_X",
                  "Drive_Y",
                  "Drive_Rotation",
                  "Lift",
                  "Mast",
                  "Claw",
                  "Lock",
                  "Winch",
                  "Time"]
        self.writer = csv.DictWriter(self.f, fieldnames=fields)
        self.writer.writeheader()

    def execute(self):
        self.writer.writerow({
            "InitTime": self.initTime
            "Drive_X": self.robot.drivetrain.x,
            "Drive_Y": self.robot.drivetrain.y,
            "Drive_Rotation": self.robot.drivetrain.rotation,
            "Lift": self.robot.lift.motor.get(),
            "Mast": self.robot.mast.motor.get(),
            "Claw": self.robot.claw.motor.get(),
            "Lock": self.robot.lock.spike.get(),
            "Winch": self.robot.winch.motor.get(),
            "Time": wpilib.Timer.getFPGATimestamp()})

    def isFinished(self):
        return self.isTimedOut()

    def end(self):
        self.f.close()

    def interrupted(self):
        self.end()

    def cancel(self):
        self.end()
        super().cancel()
<commit_msg>Macro time fail? Not anymore with the new macros!<commit_after>__author__ = "auxiliary-character"
from wpilib.command import Command
from wpilib.timer import Timer
import wpilib
import csv

class RecordMacro(Command):
    """This records robot movements and writes them to a .csv file."""
    def __init__(self, robot, name):
        super().__init__()
        self.robot = robot
        self.setTimeout(15)
        self.name = name
        self.initTime = wpilib.Timer.getFPGATimestamp()

    def initialize(self):
        self.f = open("/home/lvuser/py/"+self.name, "w")
        fields = ["Drive_X",
                  "Drive_Y",
                  "Drive_Rotation",
                  "Lift",
                  "Mast",
                  "Claw",
                  "Lock",
                  "Winch",
                  "Time"]
        self.writer = csv.DictWriter(self.f, fieldnames=fields)
        self.writer.writeheader()

    def execute(self):
        self.writer.writerow({
            "InitTime": self.initTime,
            "Drive_X": self.robot.drivetrain.x,
            "Drive_Y": self.robot.drivetrain.y,
            "Drive_Rotation": self.robot.drivetrain.rotation,
            "Lift": self.robot.lift.motor.get(),
            "Mast": self.robot.mast.motor.get(),
            "Claw": self.robot.claw.motor.get(),
            "Lock": self.robot.lock.spike.get(),
            "Winch": self.robot.winch.motor.get(),
            "Time": wpilib.Timer.getFPGATimestamp() - self.initTime})

    def isFinished(self):
        return self.isTimedOut()

    def end(self):
        self.f.close()

    def interrupted(self):
        self.end()

    def cancel(self):
        self.end()
        super().cancel()

{'fraction_non_alphanumeric': 0.13410645257210824, 'fraction_numerical': 0.0011894142134998512, 'mean_word_length': 1.829268292682927, 'pattern_counts': {'":': 20, '<': 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': '4004147', 'n_tokens_mistral': 1079, 'n_tokens_neox': 1009, 'n_words': 199}