<commit_before>from i2c import I2C
from enum import IntEnum

class Command(IntEnum) :
    MOVE_UP = 1
    MOVE_DOWN = 0

class Adress(IntEnum) :
    SERVO_CLAMP = 0
    SERVO_DYNAMIXEL = 1
    SERVO_PUSH = 2
    SERVO_STACK = 3


class ArduinoServo(I2C) :
    """
    This class is an abstraction around the I2C communication with
    the servo-arduino module.

    Details of the "protocol" used:

    The Raspberry Pi sends a byte to the module containing a command
    and a servo number. Both informations are coded on 4 bits
    totalling 8 bits together. The 4 first bits are for the serov adress,

    and the 4 next is used for the action to do with it.

    Opening/closing the clamp adress is 0
    Dynamixel (ascending and descending the clamp) adress is 1

    """

    def __init__(self, address):
        """Constructor takes the adress of the I2C module"""
        super(ArduinoServo, self).__init__(address)

    def up_clamp(self) :
        cmd = I2C.pack8(Adress.SERVO_DYNAMIXEL, Command.MOVE_UP)
        self.send(cmd)

    def down_clamp(self) :
        cmd = I2C.pack8(Adress.SERVO_DYNAMIXEL, Command.MOVE_DOWN)
        self.send(cmd)

    def close_clamp(self) :
        cmd = I2C.pack8(Adress.SERVO_CLAMP, Command.MOVE_UP)
        self.send(cmd)

    def open_clamp(self) :
        cmd = I2C.pack8(Adress.SERVO_CLAMP, Command.MOVE_DOWN)
        self.send(cmd)

    def push_out(self) :
        cmd = I2C.pack8(Adress.SERVO_PUSH, Command.MOVE_DOWN)
        self.send(cmd)

    def push_back(self) :
        cmd = I2C.pack8(Adress.SERVO_PUSH, Command.MOVE_UP)
        self.send(cmd)

    def stack_bloc(self) :
        cmd = I2C.pack8(Adress.SERVO_STACK, Command.MOVE_DOWN)
        self.send(cmd)

    def release_bloc(self) :
        cmd = I2C.pack8(Adress.SERVO_STACK, Command.MOVE_UP)
        self.send(cmd)<commit_msg>Adpation of raspi parameters<commit_after>from i2c import I2C
from enum import IntEnum

class Command(IntEnum) :
    MOVE_UP = 1
    MOVE_DOWN = 0

class Adress(IntEnum) :
    SERVO_CLAMP = 0
    SERVO_DYNAMIXEL = 1
    SERVO_PUSH = 2


class ArduinoServo(I2C) :
    """
    This class is an abstraction around the I2C communication with
    the servo-arduino module.

    Details of the "protocol" used:

    The Raspberry Pi sends a byte to the module containing a command
    and a servo number. Both informations are coded on 4 bits
    totalling 8 bits together. The 4 first bits are for the serov adress,

    and the 4 next is used for the action to do with it.

    Opening/closing the clamp adress is 0
    Dynamixel (ascending and descending the clamp) adress is 1

    """

    def __init__(self, address):
        """Constructor takes the adress of the I2C module"""
        super(ArduinoServo, self).__init__(address)

    def up_clamp(self) :
        cmd = I2C.pack8(Adress.SERVO_DYNAMIXEL, Command.MOVE_UP)
        self.send(cmd)

    def down_clamp(self) :
        cmd = I2C.pack8(Adress.SERVO_DYNAMIXEL, Command.MOVE_DOWN)
        self.send(cmd)

    def close_clamp(self) :
        cmd = I2C.pack8(Adress.SERVO_CLAMP, Command.MOVE_UP)
        self.send(cmd)

    def open_clamp(self) :
        cmd = I2C.pack8(Adress.SERVO_CLAMP, Command.MOVE_DOWN)
        self.send(cmd)

    def push_out(self) :
        cmd = I2C.pack8(Adress.SERVO_PUSH, Command.MOVE_UP)
        self.send(cmd)

    def push_back(self) :
        cmd = I2C.pack8(Adress.SERVO_PUSH, Command.MOVE_DOWN)
        self.send(cmd)
{'fraction_non_alphanumeric': 0.08253692441355343, 'fraction_numerical': 0.017665797856936, 'mean_word_length': 2.709989258861439, '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': '7536635', 'n_tokens_mistral': 1281, 'n_tokens_neox': 1212, 'n_words': 326}