<commit_before>
import TMCL

class StepRocker(object):
    def __init__(self, *args, **kwargs):
        self.TMCL = TMCL.Device(*args, **kwargs)
        self.motors = range(self.TMCL.num_motors)

    def get_globals(self):
        ret = {}
        for key, value in TMCL.GLOBAL_PARAMETER.iteritems():
#            print "GGP:", key + value
            bank, par, name, _, _ = key + value
            ret[name] = self.TMCL.ggp(bank, par)
        return ret

    def get_parameters(self):
        retmotor = [{} for _ in self.motors]
        retsingle = {}
        for mn in self.motors:
            for key, value in TMCL.AXIS_PARAMETER.iteritems():
#                print "GAP:", mn, (key,) + value
                par, name, _, _ = (key,) + value
                if par not in TMCL.SINGLE_AXIS_PARAMETERS:
                    retmotor[mn][name] = self.TMCL.gap(mn, par)
                elif mn == 0:
                    retsingle[name] = self.TMCL.gap(mn, par)
        return retmotor, retsingle

    def set_important_parameters(self,
                                 max_speed=2000, max_accel=2000,
                                 max_current=72, standbycurrent=32,
                                 microstep_resolution=1, store=False):
        for mn in self.motors:
            self.TMCL.sap(mn, 4, max_speed)
            self.TMCL.sap(mn, 5, max_accel)
            self.TMCL.sap(mn, 6, max_current)
            self.TMCL.sap(mn, 7, standbycurrent)
            self.TMCL.sap(mn, 140, int(microstep_resolution))
            if store:
                self.TMCL.stap(mn, 4)
                self.TMCL.stap(mn, 5)
                self.TMCL.stap(mn, 6)
                self.TMCL.stap(mn, 7)
                self.TMCL.stap(mn, 140)

    def rotate(self, frequency, motor=0, steps=1, direction='cw'):
        microstep_resolution = self.TMCL.gap(motor, 140)
        vel = frequency * steps * microstep_resolution
        if direction == 'cw':
            self.TMCL.ror(motor, vel)
        elif direction == 'ccw':
            self.TMCL.rol(motor, vel)
        else:
            raise ValueError('direction needs to be either "cw" or "ccw"')

    def stop(self, motor=0):
        self.TMCL.mst(motor)


<commit_msg>had missed one type conversion<commit_after>
import TMCL

class StepRocker(object):
    def __init__(self, *args, **kwargs):
        self.TMCL = TMCL.Device(*args, **kwargs)
        self.motors = range(self.TMCL.num_motors)

    def get_globals(self):
        ret = {}
        for key, value in TMCL.GLOBAL_PARAMETER.iteritems():
#            print "GGP:", key + value
            bank, par, name, _, _ = key + value
            ret[name] = self.TMCL.ggp(bank, par)
        return ret

    def get_parameters(self):
        retmotor = [{} for _ in self.motors]
        retsingle = {}
        for mn in self.motors:
            for key, value in TMCL.AXIS_PARAMETER.iteritems():
#                print "GAP:", mn, (key,) + value
                par, name, _, _ = (key,) + value
                if par not in TMCL.SINGLE_AXIS_PARAMETERS:
                    retmotor[mn][name] = self.TMCL.gap(mn, par)
                elif mn == 0:
                    retsingle[name] = self.TMCL.gap(mn, par)
        return retmotor, retsingle

    def set_important_parameters(self,
                                 max_speed=2000, max_accel=2000,
                                 max_current=72, standbycurrent=32,
                                 microstep_resolution=1, store=False):
        for mn in self.motors:
            self.TMCL.sap(mn, 4, max_speed)
            self.TMCL.sap(mn, 5, max_accel)
            self.TMCL.sap(mn, 6, max_current)
            self.TMCL.sap(mn, 7, standbycurrent)
            self.TMCL.sap(mn, 140, microstep_resolution)
            if store:
                self.TMCL.stap(mn, 4)
                self.TMCL.stap(mn, 5)
                self.TMCL.stap(mn, 6)
                self.TMCL.stap(mn, 7)
                self.TMCL.stap(mn, 140)

    def rotate(self, frequency, motor=0, steps=1, direction='cw'):
        microstep_resolution = self.TMCL.gap(motor, 140)
        vel = frequency * steps * microstep_resolution
        if direction == 'cw':
            self.TMCL.ror(motor, vel)
        elif direction == 'ccw':
            self.TMCL.rol(motor, vel)
        else:
            raise ValueError('direction needs to be either "cw" or "ccw"')

    def stop(self, motor=0):
        self.TMCL.mst(motor)



{'fraction_non_alphanumeric': 0.11541929666366095, 'fraction_numerical': 0.015329125338142471, 'mean_word_length': 1.6680697534576068, 'pattern_counts': {'":': 0, '<': 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': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1617944', 'n_tokens_mistral': 1518, 'n_tokens_neox': 1405, 'n_words': 312}