pybricks: remove non-EV3 APIs

This is the v2 branch which only supports EV3. Removing the extra APIs
will prevent them from showing up when this library is used for code
completion.
This commit is contained in:
David Lechner
2020-12-28 16:36:47 -06:00
parent dca8518575
commit eb7f441c9e
11 changed files with 12 additions and 712 deletions
+1 -262
View File
@@ -4,7 +4,7 @@
"""Generic cross-platform module for typical devices like lights, displays,
speakers, and batteries."""
from .parameters import Direction, Stop, Axis
from .parameters import Direction, Stop
class DCMotor:
@@ -389,22 +389,6 @@ class Speaker:
pass
class Light:
"""Control a single-color light."""
def on(self, brightness=100):
"""Turn on the light at the specified brightness.
Arguments:
brightness (:ref:`brightness`):
Brightness of the light.
"""
def off(self):
"""Turns off the light."""
pass
class ColorLight:
"""Control a multi-color light."""
@@ -432,119 +416,6 @@ class ColorLight:
pass
class LightArray:
"""Control an array of single-color lights."""
def __init__(self, lights):
"""Initializes the light array.
Arguments:
lights (int): Number of lights
"""
pass
def on(self, brightness=100):
"""Turns on all the lights at the specified brightness.
Arguments:
brightness (:ref:`brightness`):
Brightness of the lights.
"""
pass
def off(self):
"""Turns off all the lights."""
pass
def array(self, *brightnesses):
"""array(first_light, ..., last_light)
Sets the brightness of each light individually.
Arguments:
brightness (:ref:`brightness`, ..., :ref:`brightness`):
Brightness of each light.
"""
pass
class LightGrid:
"""Control a rectangular grid of single-color lights."""
def __init__(self, rows, columns):
"""Initializes the light grid.
Arguments:
rows (int): Number of rows in the grid
columns (int): Number of columns in the grid
"""
pass
def image(self, matrix, clear=True):
"""Shows an image made up of pixels of a given brightness.
Arguments:
matrix (2D Array): Matrix of intensities (:ref:`brightness`).
clear (bool): Whether to turn off all the lights before showing
the new image. If you choose ``False``,
the given matrix is added to one already shown.
"""
pass
def pixel(self, row, column, brightness):
"""Turns on a pixel at the specified brightness.
Arguments:
row (int): Vertical grid index, starting at 0 from the top.
column (int): Horizontal grid index, starting at 0 from the left.
brightness (:ref:`brightness`): Brightness of the pixel.
"""
pass
def on(self, brightness=100):
"""Turns on all the pixels at the specified brightness.
Arguments:
brightness (:ref:`brightness`):
Brightness of the lights.
"""
pass
def off(self):
"""Turns off all the pixels."""
pass
def number(self, number):
"""Displays a number on the light grid.
Arguments:
number (int): The number to be displayed.
"""
pass
def char(self, character):
"""Displays a character or symbol on the light grid. This may
be any letter (``a``--``z``), capital letter (``A``--``Z``) or one of
the following symbols: ``!"#$%&'()*+,-./:;<=>?@[\\]^_`{|}``.
Arguments:
character (str): The character or symbol to be displayed.
"""
pass
def text(self, text, pause=500):
"""Displays a text string, one character at a time, with a pause
between each character. After the last character is shown, the light
grid turns off.
Arguments:
character (str): The character or symbol to be displayed.
time (:ref:`time`): How long to show a character before showing
the next one.
"""
pass
class KeyPad:
"""Get status of buttons on a keypad layout."""
@@ -577,135 +448,3 @@ class Battery:
"""
pass
class Accelerometer:
"""Get measurements from an accelerometer."""
def neutral(self, top, front):
"""Configures the neutral orientation of the device or hub. You do this
by specifying how it is mounted on your design, in terms of the
:ref:`robot reference frame <robotframe>`.
In this given neutral orientation, the tilt and heading will then be
zero.
Arguments:
top (Axis): Which direction the top of the device faces in the
neutral orientation. For example, you can
choose ``top=-Axis.Z`` if you mounted it such that the
neutral orientation is upside down.
front (Axis): Which direction the front of the device faces in the
neutral orientation.
"""
pass
def acceleration(self, axis=Axis.ALL):
"""acceleration(axis=Axis.ALL)
Gets the acceleration of the device along a given axis in the
:ref:`robot reference frame <robotframe>`.
Arguments:
axis (Axis): Axis along which the acceleration is
measured.
Returns:
:ref:`linacceleration`. Returns a :ref:`scalar` of the acceleration
along the specified axis.
If you choose ``axis=Axis.ALL``, you get a :ref:`vector` with the
accelerations along all three axes (x, y, z).
"""
pass
def tilt(self):
"""Gets the pitch and roll angles relative to the neutral, horizontal
orientation.
The order of rotation is pitch-then-roll. This is equivalent to a
positive rotation along the x-axis and then a positive rotation
along the y-axis.
Returns:
(:ref:`angle`, :ref:`angle`): Pitch and roll angles.
"""
pass
def tapped(self):
"""Checks if the device or hub was tapped.
Returns:
bool:
``True`` if tapped since this method was last called. ``False``
otherwise.
"""
# def tapped(self, axis=Axis.ALL, bidirectional=True, tolerance=45):
pass
def shaken(self):
"""Checks if the device or hub was shaken.
Returns:
bool:
``True`` if shaken since this method was last called. ``False``
otherwise.
"""
# def shaken(self, axis=Axis.ALL, bidirectional=True, tolerance=45):
pass
def up(self):
"""Checks which side of the device or hub currently faces upward.
:returns:
``Side.TOP``, ``Side.BOTTOM``, ``Side.LEFT``, ``Side.RIGHT``,
``Side.FRONT`` or ``Side.BACK``.
:rtype: :class:`Side <.parameters.Side>`
"""
pass
class IMU(Accelerometer):
def heading(self):
"""Gets the heading angle relative to the starting orientation. It is a
a positive rotation around the :ref:`z-axis in the robot
frame <robotframe>`, prior to applying any tilt rotation.
For a vehicle viewed from the top, this means that
a positive heading value corresponds to a counterclockwise rotation.
Returns:
:ref:`angle`: Heading angle relative to starting orientation.
"""
pass
def reset_heading(self, angle):
"""Resets the accumulated heading angle of the robot.
Arguments:
angle (:ref:`angle`): Value to which the heading should be reset.
"""
pass
def gyro(self, axis=Axis.ALL):
"""gyro(axis=Axis.ALL)
Measures the angular velocity of the device along a given axis in the
:ref:`robot reference frame <robotframe>`.
Arguments:
axis (Axis): Axis along which the angular velocity is
measured.
Returns:
:ref:`speed`. Returns a :ref:`scalar` of the angular velocity
along the specified axis.
If you choose ``axis=Axis.ALL``, you get a :ref:`vector` with the
angular velocities along all three axes (x, y, z).
"""
pass