<commit_before>from BrickPi import *
#Generic (functional) API for brickpi operations
#Author: <NAME>
#Originally created: June.13.2015
#
NO_SENSOR = -1

def setup(sensor1 = NO_SENSOR, sensor2 = NO_SENSOR, sensor3 = NO_SENSOR, sensor4 = NO_SENSOR):
    BrickPiSetup()
    if(sensor1 != NO_SENSOR):
        BrickPi.SensorType[PORT_1] = sensor1
    if(sensor2 != NO_SENSOR):
        BrickPi.SensorType[PORT_2] = sensor2
    if(sensor3 != NO_SENSOR):
        BrickPi.SensorType[PORT_3] = sensor3
    if(sensor4 != NO_SENSOR):
        BrickPi.SensorType[PORT_4] = sensor4
    BrickPiSetupSensors()
    BrickPi.MotorEnable[PORT_A] = 1 #Enable the Motor A
    BrickPi.MotorEnable[PORT_B] = 1 #Enable the Motor B
    BrickPi.MotorEnable[PORT_C] = 1 #Enable the Motor C
    BrickPi.MotorEnable[PORT_D] = 1 #Enable the Motor D
    return
def get_sensor_value(port_num):
    BrickPiUpdateValues()
    return BrickPi.Sensor[port_num]
def set_sensor_type(port_num, sensor_type):
    BrickPi.SensorType[port_num] = sensor_type
    BrickPiSetupSensors()
    return
def get_encoder_value(port_num):
    BrickPiUpdateValues()
    return BrickPi.Encoder[port_num]
def set_motor_value(port_num):
    BrickPi.MotorSpeed[port_num]
    BrickPiUpdateValues()<commit_msg>python error on motors<commit_after>from BrickPi import *
#Generic (functional) API for brickpi operations
#Author: <NAME>
#Originally created: June.13.2015
#
NO_SENSOR = -1

def setup(sensor1 = NO_SENSOR, sensor2 = NO_SENSOR, sensor3 = NO_SENSOR, sensor4 = NO_SENSOR):
    BrickPiSetup()
    if(sensor1 != NO_SENSOR):
        BrickPi.SensorType[PORT_1] = sensor1
    if(sensor2 != NO_SENSOR):
        BrickPi.SensorType[PORT_2] = sensor2
    if(sensor3 != NO_SENSOR):
        BrickPi.SensorType[PORT_3] = sensor3
    if(sensor4 != NO_SENSOR):
        BrickPi.SensorType[PORT_4] = sensor4
    BrickPiSetupSensors()
    BrickPi.MotorEnable[PORT_A] = 1 #Enable the Motor A
    BrickPi.MotorEnable[PORT_B] = 1 #Enable the Motor B
    BrickPi.MotorEnable[PORT_C] = 1 #Enable the Motor C
    BrickPi.MotorEnable[PORT_D] = 1 #Enable the Motor D
    return
def get_sensor_value(port_num):
    BrickPiUpdateValues()
    return BrickPi.Sensor[port_num]
def set_sensor_type(port_num, sensor_type):
    BrickPi.SensorType[port_num] = sensor_type
    BrickPiSetupSensors()
    return
def get_encoder_value(port_num):
    BrickPiUpdateValues()
    return BrickPi.Encoder[port_num]
def set_motor_value(port_num, value):
    BrickPi.MotorSpeed[port_num] = value
    BrickPiUpdateValues()
{'fraction_non_alphanumeric': 0.09761904761904762, 'fraction_numerical': 0.02142857142857143, 'mean_word_length': 4.263048016701461, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '1670388', 'n_tokens_mistral': 957, 'n_tokens_neox': 935, 'n_words': 182}