From e244f28ddb221950eae4ad5b37abf398423e06f3 Mon Sep 17 00:00:00 2001 From: Laurens Valk Date: Mon, 13 Jan 2020 12:19:59 +0100 Subject: [PATCH] api/builtins: drop method string override We had these because enums expanded to numeric values. Because we now have an alternate enum implementation, we don't need these strings anymore. --- pybricks/builtins.py | 33 ++++++++++++--------------------- pybricks/ev3devices.py | 4 ++-- 2 files changed, 14 insertions(+), 23 deletions(-) diff --git a/pybricks/builtins.py b/pybricks/builtins.py index 068af98..181f68d 100644 --- a/pybricks/builtins.py +++ b/pybricks/builtins.py @@ -10,7 +10,7 @@ class DCMotor(): def __init__(self, port, positive_direction=Direction.CLOCKWISE): - """DCMotor(port, positive_direction=Direction.CLOCKWISE) + """ Arguments: port (Port): Port to which the motor is connected. @@ -64,7 +64,7 @@ class Motor(DCMotor): def __init__(self, port, positive_direction=Direction.CLOCKWISE, gears=None): - """Motor(port, positive_direction=Direction.CLOCKWISE, gears=None) + """ Arguments: port (Port): Port to which the motor is connected. @@ -128,9 +128,7 @@ class Motor(DCMotor): pass def stop(self, stop_type=Stop.COAST): - """stop(stop_type=Stop.COAST) - - Stop the motor. + """Stop the motor. Arguments: stop_type (Stop): Whether to coast, brake, or hold (*Default*: @@ -152,10 +150,8 @@ class Motor(DCMotor): pass def run_time(self, speed, time, stop_type=Stop.COAST, wait=True): - """run_time(speed, time, stop_type=Stop.COAST, wait=True) - - Run the motor at a constant speed (angular velocity) for a given amount - of time. + """Run the motor at a constant speed (angular velocity) for a given + amount of time. The motor will accelerate towards the requested speed and the duty cycle is automatically adjusted to keep the speed constant, even under @@ -177,9 +173,8 @@ class Motor(DCMotor): def run_angle(self, speed, rotation_angle, stop_type=Stop.COAST, wait=True): - """run_angle(speed, rotation_angle, stop_type=Stop.COAST, wait=True) - - Run the motor at a constant speed (angular velocity) by a given angle. + """Run the motor at a constant speed (angular velocity) by a given + angle. The motor will accelerate towards the requested speed and the duty cycle is automatically adjusted to keep the speed constant, even under @@ -201,10 +196,8 @@ class Motor(DCMotor): pass def run_target(self, speed, target_angle, stop_type=Stop.COAST, wait=True): - """run_target(speed, target_angle, stop_type=Stop.COAST, wait=True) - - Run the motor at a constant speed (angular velocity) towards a given - target angle. + """ Run the motor at a constant speed (angular velocity) towards a + given target angle. The motor will accelerate towards the requested speed and the duty cycle is automatically adjusted to keep the speed constant, even under @@ -233,11 +226,9 @@ class Motor(DCMotor): pass def run_until_stalled(self, speed, stop_type=Stop.COAST, duty_limit=None): - """run_until_stalled(speed, stop_type=Stop.COAST, duty_limit=default) - - Run the motor at a constant speed (angular velocity) until it stalls. - The motor is considered stalled when it cannot move even with the - maximum torque. See :meth:`.stalled` for a more precise definition. + """Run the motor at a constant speed (angular velocity) until it + stalls. The motor is considered stalled when it cannot move even with + the maximum torque. See :meth:`.stalled` for a more precise definition. The ``duty_limit`` argument lets you temporarily limit the motor torque during this maneuver. This is useful to avoid applying the full motor diff --git a/pybricks/ev3devices.py b/pybricks/ev3devices.py index dc80930..99d20c2 100644 --- a/pybricks/ev3devices.py +++ b/pybricks/ev3devices.py @@ -190,7 +190,7 @@ class GyroSensor(): """ def __init__(self, port, positive_direction=Direction.CLOCKWISE): - """GyroSensor(port, positive_direction=Direction.CLOCKWISE) + """ Arguments: port (Port): Port to which the sensor is connected. @@ -298,7 +298,7 @@ class AnalogSensor(): """Generic or custom analog sensor.""" def __init__(self, port, check_type=True): - """AnalogSensor(port, check_type=True) + """ Arguments: port (Port): Port to which the sensor is connected.