<commit_before>from .module import Module, interact
from .gpio import Pwm


class PositionServo(object):
    def __init__(self, alias, delegate, default= 0.0, min=0.0, max=180.0):
        self._pos = None
        self._pwm = Pwm(alias, delegate, default, min, max)

    @property
    def target_position(self):
        return self._pos

    @target_position.setter
    def target_position(self, pos):
        if pos != self._pos:
            self._pwm.duty_cycle = pos
            self._pos = pos


class L0Servo(Module):
    def __init__(self, id, alias, robot):
        Module.__init__(self, 'L0Servo', id, alias, robot)

        self.m1 = PositionServo('p1', self)
        self.m2 = PositionServo('p2', self)
        self.m3 = PositionServo('p3', self)
        self.m4 = PositionServo('p4', self)

    def control(self):
        def change_pos(p1, p2, p3, p4):
            self.m1.target_position = p1
            self.m2.target_position = p2
            self.m3.target_position = p3
            self.m4.target_position = p4

        return interact(change_pos,
                        p1=lambda: self.m1.target_position,
                        p2=lambda: self.m2.target_position,
                        p3=lambda: self.m3.target_position,
                        p4=lambda: self.m4.target_position)
<commit_msg>Typo.<commit_after>from .module import Module, interact
from .gpio import Pwm


class PositionServo(object):
    def __init__(self, alias, delegate, default=0.0, min=0.0, max=180.0):
        self._pos = None
        self._pwm = Pwm(alias, delegate, default, min, max)

    @property
    def target_position(self):
        return self._pos

    @target_position.setter
    def target_position(self, pos):
        if pos != self._pos:
            self._pwm.duty_cycle = pos
            self._pos = pos


class L0Servo(Module):
    def __init__(self, id, alias, robot):
        Module.__init__(self, 'L0Servo', id, alias, robot)

        self.m1 = PositionServo('p1', self)
        self.m2 = PositionServo('p2', self)
        self.m3 = PositionServo('p3', self)
        self.m4 = PositionServo('p4', self)

    def control(self):
        def change_pos(p1, p2, p3, p4):
            self.m1.target_position = p1
            self.m2.target_position = p2
            self.m3.target_position = p3
            self.m4.target_position = p4

        return interact(change_pos,
                        p1=lambda: self.m1.target_position,
                        p2=lambda: self.m2.target_position,
                        p3=lambda: self.m3.target_position,
                        p4=lambda: self.m4.target_position)

{'fraction_non_alphanumeric': 0.10857142857142857, 'fraction_numerical': 0.02895238095238095, 'mean_word_length': 2.0358381502890173, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7218192', 'n_tokens_mistral': 861, 'n_tokens_neox': 831, 'n_words': 183}