From 650044003189ad3d8e28e52edc97f53a668fa452 Mon Sep 17 00:00:00 2001 From: Laurens Valk Date: Fri, 10 Jun 2022 10:46:44 +0200 Subject: [PATCH] pybricks: Drop most ellipsis and pass instances. See [1]: "I still prefer ... over pass. This clarifies to the readers that they are reading a stub. But if there's a docstring we need neither." [1] https://github.com/srittau/type-stub-pep/issues/88#issuecomment-758843441 Fixes https://github.com/pybricks/pybricks-api/issues/101#issuecomment-1148780369 --- src/pybricks/_common.py | 66 +-------------------------------- src/pybricks/ev3dev/_speaker.py | 8 ---- src/pybricks/ev3devices.py | 19 ---------- src/pybricks/geometry.py | 3 -- src/pybricks/hubs.py | 4 -- src/pybricks/iodevices.py | 22 ----------- src/pybricks/media/ev3dev.py | 9 ----- src/pybricks/nxtdevices.py | 20 ---------- src/pybricks/pupdevices.py | 18 --------- src/pybricks/robotics.py | 10 ----- src/pybricks/tools.py | 9 +---- 11 files changed, 2 insertions(+), 186 deletions(-) diff --git a/src/pybricks/_common.py b/src/pybricks/_common.py index 343daf4..47d2b42 100644 --- a/src/pybricks/_common.py +++ b/src/pybricks/_common.py @@ -30,13 +30,11 @@ class System: or a tuple of multiple buttons. Choose ``None`` to disable the stop button altogether. """ - pass def shutdown(self) -> None: """shutdown() Stops your program and shuts the hub down.""" - pass def reset_reason(self) -> int: """reset_reason() -> int @@ -53,7 +51,6 @@ class System: crashed due to a watchdog timeout, which indicates a firmware issue. """ - pass def name(self) -> str: """name() -> str @@ -64,7 +61,6 @@ class System: Returns: The hub name. """ - pass class DCMotor: @@ -79,7 +75,6 @@ class DCMotor: positive_direction (Direction): Which direction the motor should turn when you give a positive duty cycle value. """ - pass def dc(self, duty: Number) -> None: """dc(duty) @@ -89,7 +84,6 @@ class DCMotor: Arguments: duty (Number, %): The duty cycle (-100.0 to 100). """ - pass def stop(self) -> None: """stop() @@ -97,7 +91,6 @@ class DCMotor: Stops the motor and lets it spin freely. The motor gradually stops due to friction.""" - pass def brake(self) -> None: """brake() @@ -106,7 +99,6 @@ class DCMotor: The motor stops due to friction, plus the voltage that is generated while the motor is still moving.""" - pass @overload def settings(self, max_voltage: Optional[int] = None) -> None: @@ -128,7 +120,6 @@ class DCMotor: max_voltage (Number, mV): Maximum voltage applied to the motor during all motor commands. """ - pass class Control: @@ -174,7 +165,6 @@ class Control: torque (:ref:`torque`): Maximum feedback torque during control. """ - pass @overload def pid(self) -> Tuple[int, int, int, None, int]: @@ -212,7 +202,6 @@ class Control: integral_rate (Number, deg/s or Number, mm/s): Maximum rate at which the error integral is allowed to grow. """ - pass @overload def target_tolerances(self) -> Tuple[int, int]: @@ -239,7 +228,6 @@ class Control: deviation from the target before motion is considered complete. """ - pass @overload def stall_tolerances(self) -> Tuple[int, int]: @@ -266,7 +254,6 @@ class Control: time (Number, ms): How long the controller has to be below this minimum ``speed`` before we say it is stalled. """ - pass def stalled(self) -> bool: """stalled() -> bool @@ -279,7 +266,6 @@ class Control: Returns: ``True`` if the controller is stalled, ``False`` if not. """ - pass def done(self) -> bool: """done() -> bool @@ -289,7 +275,6 @@ class Control: Returns: ``True`` if the command is done, ``False`` if not. """ - pass def load(self) -> int: """load() -> int: mNm @@ -303,7 +288,6 @@ class Control: Returns: The load torque. It returns 0 if control is not active. """ - pass class Motor(DCMotor): @@ -346,7 +330,6 @@ class Motor(DCMotor): current value, so your program knows where it left off last time. """ - pass def angle(self) -> int: """angle() -> int: deg @@ -356,7 +339,6 @@ class Motor(DCMotor): Returns: Motor angle. """ - pass def speed(self) -> int: """speed() -> int: deg/s @@ -367,7 +349,6 @@ class Motor(DCMotor): Motor speed. """ - pass def reset_angle(self, angle: Number) -> None: """ @@ -378,13 +359,11 @@ class Motor(DCMotor): Arguments: angle (Number, deg): Value to which the angle should be reset. """ - pass def hold(self) -> None: """hold() Stops the motor and actively holds it at its current angle.""" - pass def run(self, speed: Number) -> None: """run(speed) @@ -397,7 +376,6 @@ class Motor(DCMotor): Arguments: speed (Number, deg/s): Speed of the motor. """ - pass def run_time( self, speed: Number, time: Number, then: Stop = Stop.HOLD, wait: bool = True @@ -417,7 +395,6 @@ class Motor(DCMotor): wait (bool): Wait for the maneuver to complete before continuing with the rest of the program. """ - pass def run_angle( self, @@ -438,7 +415,6 @@ class Motor(DCMotor): wait (bool): Wait for the maneuver to complete before continuing with the rest of the program. """ - pass def run_target( self, @@ -461,7 +437,6 @@ class Motor(DCMotor): wait (bool): Wait for the motor to reach the target before continuing with the rest of the program. """ - pass def run_until_stalled( self, @@ -485,7 +460,6 @@ class Motor(DCMotor): Returns: Angle at which the motor becomes stalled. """ - pass def track_target(self, target_angle: Number) -> None: """track_target(target_angle) @@ -499,7 +473,6 @@ class Motor(DCMotor): target_angle (Number, deg): Target angle that the motor should rotate to. """ - pass class Speaker: @@ -524,7 +497,6 @@ class Speaker: Arguments: volume (Number, %): Volume of the speaker in the 0-100 range. """ - pass def beep(self, frequency: Number = 500, duration: Number = 100) -> None: """beep(frequency=500, duration=100) @@ -539,7 +511,6 @@ class Speaker: than 0, then the method returns immediately and the frequency play continues to play indefinitely. """ - pass def play_notes(self, notes: Iterable[str], tempo: Number = 120) -> None: """play_notes(notes, tempo=120) @@ -574,7 +545,6 @@ class Speaker: tempo (int): Beats per minute. A quarter note is one beat. """ - pass class ColorLight: @@ -588,13 +558,11 @@ class ColorLight: Arguments: color (Color): Color of the light. """ - pass def off(self) -> None: """off() Turns off the light.""" - pass def blink(self, color: Color, durations: Collection[int]) -> None: """blink(color, durations) @@ -642,7 +610,6 @@ class LightArray: Arguments: n (int): Number of lights """ - pass def on(self, brightness: Union[int, Collection[int]]) -> None: """on(brightness) @@ -655,13 +622,11 @@ class LightArray: If you give just one brightness value, all lights get that brightness. """ - pass def off(self) -> None: """off() Turns off all the lights.""" - pass class LightMatrix: @@ -676,7 +641,6 @@ class LightMatrix: rows (int): Number of rows in the grid columns (int): Number of columns in the grid """ - pass def orientation(self, up: Side) -> None: """orientation(up) @@ -691,7 +655,6 @@ class LightMatrix: design. Choose ``Side.TOP``, ``Side.LEFT``, ``Side.RIGHT``, or ``Side.BOTTOM``. """ - pass def image(self, matrix: Matrix) -> None: """image(matrix) @@ -703,7 +666,6 @@ class LightMatrix: matrix (Matrix): Matrix of intensities (:ref:`brightness`). A 2D list is also accepted. """ - pass def animate(self, matrices: Collection[Matrix], interval: Number) -> None: """animate(matrices, interval) @@ -719,7 +681,6 @@ class LightMatrix: :class:`Matrix ` of intensities. interval (Number, ms): Time to display each image in the list. """ - pass def pixel(self, row: int, column: int, brightness: Number = 100) -> None: """pixel(row, column, brightness=100) @@ -731,13 +692,11 @@ class LightMatrix: column (int): Horizontal grid index, starting at 0 from the left. brightness (:ref:`brightness`): Brightness of the pixel. """ - pass def off(self) -> None: """off() Turns off all the pixels.""" - pass def number(self, number: Number) -> None: """number(number) @@ -751,7 +710,6 @@ class LightMatrix: Arguments: number (int): The number to be displayed. """ - pass def char(self, char: str) -> None: """char(char) @@ -763,7 +721,6 @@ class LightMatrix: Arguments: character (str): The character or symbol to be displayed. """ - pass def text(self, text: str, on: Number = 500, off: Number = 50) -> None: """text(text, on=500, off=50) @@ -778,14 +735,13 @@ class LightMatrix: off (Number, ms): For how long the display is off between characters. """ - pass class Keypad: """Get status of buttons on a keypad layout.""" def __init__(self, active_buttons): - pass + ... def pressed(self) -> Tuple[Button]: """pressed() -> Tuple[Button] @@ -795,7 +751,6 @@ class Keypad: Returns: Tuple of pressed buttons. """ - pass class Battery: @@ -809,7 +764,6 @@ class Battery: Returns: Battery voltage. """ - pass def current(self) -> int: """current() -> int: mA @@ -819,7 +773,6 @@ class Battery: Returns: Battery current. """ - pass class Charger: @@ -849,7 +802,6 @@ class Charger: Returns: Status value. """ - pass def current(self) -> int: """current() -> int: mA @@ -859,7 +811,6 @@ class Charger: Returns: Charging current. """ - pass class SimpleAccelerometer: @@ -873,7 +824,6 @@ class SimpleAccelerometer: Returns: Acceleration along all three axes. """ - pass def up(self) -> Side: """up() -> Side @@ -884,7 +834,6 @@ class SimpleAccelerometer: ``Side.TOP``, ``Side.BOTTOM``, ``Side.LEFT``, ``Side.RIGHT``, ``Side.FRONT`` or ``Side.BACK``. """ - pass class Accelerometer(SimpleAccelerometer): @@ -914,7 +863,6 @@ class Accelerometer(SimpleAccelerometer): Acceleration along the specified axis. If you specify no axis, this returns a vector of accelerations along all axes. """ - pass def tilt(self) -> Tuple[int, int]: """tilt() -> Tuple[int, int] @@ -929,7 +877,6 @@ class Accelerometer(SimpleAccelerometer): Returns: Tuple of pitch and roll angles. """ - pass class IMU(Accelerometer): @@ -949,7 +896,6 @@ class IMU(Accelerometer): Heading angle relative to starting orientation. """ - pass def reset_heading(self, angle: Number) -> None: """reset_heading(angle: Number) @@ -961,7 +907,6 @@ class IMU(Accelerometer): Arguments: angle (Number, deg): Value to which the heading should be reset. """ - pass @overload def angular_velocity(self) -> Matrix: @@ -986,7 +931,6 @@ class IMU(Accelerometer): Angular velocity along the specified axis. If you specify no axis, this returns a vector of accelerations along all axes. """ - pass class CommonColorSensor: @@ -998,7 +942,6 @@ class CommonColorSensor: Arguments: port (Port): Port to which the sensor is connected. """ - pass def color(self) -> Color: """color() -> Color @@ -1013,7 +956,6 @@ class CommonColorSensor: Returns: Detected color. """ - pass def hsv(self) -> Color: """hsv() -> Color @@ -1028,7 +970,6 @@ class CommonColorSensor: Measured color. The color is described by a hue (0--359), a saturation (0--100), and a brightness value (0--100). """ - pass def ambient(self) -> int: """ambient() -> int: % @@ -1039,7 +980,6 @@ class CommonColorSensor: Ambient light intensity, ranging from 0% (dark) to 100% (bright). """ - pass def reflection(self) -> int: """reflection() -> int: % @@ -1051,7 +991,6 @@ class CommonColorSensor: Measured reflection, ranging from 0% (no reflection) to 100% (high reflection). """ - pass @overload def detectable_colors(self, colors: Collection[Color]) -> None: @@ -1083,7 +1022,6 @@ class CommonColorSensor: better results. You measure your own colors with the ``hsv()`` method. """ - pass class AmbientColorSensor(CommonColorSensor): @@ -1108,7 +1046,6 @@ class AmbientColorSensor(CommonColorSensor): Returns: Detected color.` """ - pass def hsv(self, surface: bool = True) -> Color: """hsv(surface=True) -> Color @@ -1128,4 +1065,3 @@ class AmbientColorSensor(CommonColorSensor): Measured color. The color is described by a hue (0--359), a saturation (0--100), and a brightness value (0--100). """ - pass diff --git a/src/pybricks/ev3dev/_speaker.py b/src/pybricks/ev3dev/_speaker.py index cde67ad..38f2738 100644 --- a/src/pybricks/ev3dev/_speaker.py +++ b/src/pybricks/ev3dev/_speaker.py @@ -23,7 +23,6 @@ class Speaker: method returns immediately and the frequency play continues to play indefinitely. """ - pass def play_notes(self, notes: Iterable[str], tempo: int = 120) -> None: """play_notes(notes, tempo=120) @@ -58,7 +57,6 @@ class Speaker: tempo (int): Beats per minute. A quarter note is one beat. """ - pass def play_file(self, file_name: Union[SoundFile, str]) -> None: """play_file(file_name) @@ -70,8 +68,6 @@ class Speaker: Path to the sound file, including the file extension. """ - pass - def say(self, text: str) -> None: """say(text) @@ -84,8 +80,6 @@ class Speaker: text (str): What to say. """ - pass - def set_speech_options( self, language: Optional[str] = None, @@ -115,7 +109,6 @@ class Speaker: Pitch (0 to 99). Higher numbers make the voice higher pitched and lower numbers make the voice lower pitched. """ - pass def set_volume(self, volume: int, which: str = "_all_") -> None: """set_volume(volume, which="_all_") @@ -131,4 +124,3 @@ class Speaker: volume for :meth:`.play_file` and :meth:`.say`. ``'_all_'`` sets both at the same time. """ - pass diff --git a/src/pybricks/ev3devices.py b/src/pybricks/ev3devices.py index 0f27aa8..323ce50 100644 --- a/src/pybricks/ev3devices.py +++ b/src/pybricks/ev3devices.py @@ -22,7 +22,6 @@ class TouchSensor: Arguments: port (Port): Port to which the sensor is connected. """ - pass def pressed(self) -> bool: """pressed() -> bool @@ -33,7 +32,6 @@ class TouchSensor: ``True`` if the sensor is pressed, ``False`` if it is not pressed. """ - pass class ColorSensor: @@ -45,7 +43,6 @@ class ColorSensor: Arguments: port (Port): Port to which the sensor is connected. """ - pass def color(self) -> Optional[Color]: """color() -> Color @@ -58,7 +55,6 @@ class ColorSensor: or ``None`` if no color is detected. """ - pass def ambient(self) -> int: """ambient() -> int: % @@ -69,7 +65,6 @@ class ColorSensor: Ambient light intensity, ranging from 0% (dark) to 100% (bright). """ - pass def reflection(self) -> int: """reflection() -> int: % @@ -81,7 +76,6 @@ class ColorSensor: 100% (high reflection). """ - pass def rgb(self) -> Tuple[int, int, int]: """rgb() -> Tuple[int, int, int] @@ -93,7 +87,6 @@ class ColorSensor: Tuple of reflections for red, green, and blue light, each ranging from 0.0% (no reflection) to 100.0% (high reflection). """ - pass class InfraredSensor: @@ -106,7 +99,6 @@ class InfraredSensor: port (Port): Port to which the sensor is connected. """ - pass def distance(self) -> int: """distance() -> int: % @@ -119,7 +111,6 @@ class InfraredSensor: to 100% (farthest). """ - pass def beacon(self, channel: int) -> Tuple[Optional[int], Optional[int]]: """ @@ -137,7 +128,6 @@ class InfraredSensor: (-75 to 75 degrees) between remote and infrared sensor or a tuple of (``None``, ``None``) if no remote is detected. """ - pass def buttons(self, channel: int) -> List[Button]: """buttons(channel) -> List[Button] @@ -154,7 +144,6 @@ class InfraredSensor: List of pressed buttons on the remote on the selected channel. """ - pass def keypad(self) -> List[Button]: """keypad() -> List[Button] @@ -169,7 +158,6 @@ class InfraredSensor: Returns: List of pressed buttons. """ - pass class GyroSensor: @@ -185,7 +173,6 @@ class GyroSensor: of the sensor. """ - pass def speed(self) -> int: """speed() -> int: deg/s @@ -196,7 +183,6 @@ class GyroSensor: Angular velocity. """ - pass def angle(self) -> int: """angle() -> int: deg @@ -207,7 +193,6 @@ class GyroSensor: Rotation angle. """ - pass def reset_angle(self, angle: int) -> None: """reset_angle(angle) @@ -217,7 +202,6 @@ class GyroSensor: Arguments: angle (Number, deg): Value to which the angle should be reset. """ - pass class UltrasonicSensor: @@ -230,7 +214,6 @@ class UltrasonicSensor: port (Port): Port to which the sensor is connected. """ - pass def distance(self, silent: bool = False) -> int: """distance(silent=False) -> int: mm @@ -249,7 +232,6 @@ class UltrasonicSensor: Measured distance. """ - pass def presence(self) -> bool: """presence() -> bool @@ -265,4 +247,3 @@ class UltrasonicSensor: ``True`` if ultrasonic sounds are detected, ``False`` if not. """ - pass diff --git a/src/pybricks/geometry.py b/src/pybricks/geometry.py index 49e4042..2527c85 100644 --- a/src/pybricks/geometry.py +++ b/src/pybricks/geometry.py @@ -63,14 +63,12 @@ class Matrix: def T(self) -> Matrix: """Returns a new :class:`.Matrix` that is the transpose of the original.""" - pass @property def shape(self) -> Tuple[int, int]: """Returns a tuple (``m``, ``n``), where ``m`` is the number of rows and ``n`` is the number of columns. """ - pass @overload @@ -99,7 +97,6 @@ def vector(*args): Returns: A matrix with the shape of a column vector. """ - pass class Axis: diff --git a/src/pybricks/hubs.py b/src/pybricks/hubs.py index 6a599cf..2c6335d 100644 --- a/src/pybricks/hubs.py +++ b/src/pybricks/hubs.py @@ -87,7 +87,6 @@ class TechnicHub: front_side (Axis): The axis that passes through the *front side* of the hub. """ - pass class PrimeHub: @@ -125,10 +124,7 @@ class PrimeHub: front_side (Axis): The axis that passes through the *front side* of the hub. """ - pass class InventorHub(PrimeHub): """LEGO® MINDSTORMS Inventor Hub.""" - - pass diff --git a/src/pybricks/iodevices.py b/src/pybricks/iodevices.py index e85c5d9..b94591d 100644 --- a/src/pybricks/iodevices.py +++ b/src/pybricks/iodevices.py @@ -17,7 +17,6 @@ class PUPDevice: Arguments: port (Port): Port to which the device is connected. """ - pass def info(self) -> Dict[str, str]: """info() -> Dict @@ -27,7 +26,6 @@ class PUPDevice: Returns: Dictionary with information, such as the device ``id``. """ - pass def read(self, mode: int) -> Tuple: """read(mode) -> Tuple @@ -40,7 +38,6 @@ class PUPDevice: Returns: Values read from the sensor. """ - pass def write(self, mode: int, data: Tuple) -> None: """write(mode, data) @@ -52,7 +49,6 @@ class PUPDevice: mode (int): Device mode. data (tuple): Values to be written. """ - pass class LUMPDevice: @@ -64,7 +60,6 @@ class LUMPDevice: Arguments: port (Port): Port to which the device is connected. """ - pass def read(self, mode: int) -> Tuple: """read(mode) -> Tuple @@ -77,7 +72,6 @@ class LUMPDevice: Returns: Values read from the sensor. """ - pass class Ev3devSensor: @@ -95,7 +89,6 @@ class Ev3devSensor: Arguments: port (Port): Port to which the device is connected. """ - pass def read(self, mode: str) -> Tuple: """read(mode) -> Tuple @@ -108,7 +101,6 @@ class Ev3devSensor: Returns: values read from the sensor. """ - pass class AnalogSensor: @@ -120,7 +112,6 @@ class AnalogSensor: Arguments: port (Port): Port to which the sensor is connected. """ - pass def voltage(self) -> int: """voltage() -> int: mV @@ -130,7 +121,6 @@ class AnalogSensor: Returns: Analog voltage. """ - pass def resistance(self) -> int: """resistance() -> int: Ω @@ -143,7 +133,6 @@ class AnalogSensor: Returns: Resistance of the analog device. """ - pass def active(self) -> None: """active() @@ -156,7 +145,6 @@ class AnalogSensor: Sensor as a custom analog sensor, this method will turn the light on. From then on, ``voltage()`` returns the raw reflected light value. """ - pass def passive(self) -> None: """passive() @@ -169,7 +157,6 @@ class AnalogSensor: Sensor as a custom analog sensor, this method will turn the light off. From then on, ``voltage()`` returns the raw ambient light value. """ - pass class I2CDevice: @@ -183,7 +170,6 @@ class I2CDevice: address(int): I2C address of the client device. See :ref:`I2C Addresses `. """ - pass def read(self, reg: Optional[int], length: Optional[int] = 1) -> bytes: """read(reg, length=1) @@ -198,7 +184,6 @@ class I2CDevice: Returns: Bytes returned from the device. """ - pass def write(self, reg: Optional[int], data: Optional[bytes] = None) -> None: """write(reg, data=None) @@ -210,7 +195,6 @@ class I2CDevice: writing: 0--255 or 0x00--0xFF. data (bytes): Bytes to be written. """ - pass class UARTDevice: @@ -226,7 +210,6 @@ class UARTDevice: during ``read`` before giving up. If you choose ``None``, it will wait forever. """ - pass def read(self, length: int = 1) -> bytes: """read(length=1) -> bytes @@ -243,7 +226,6 @@ class UARTDevice: Returns: Bytes returned from the device. """ - pass def read_all(self) -> bytes: """read_all() -> bytes @@ -253,7 +235,6 @@ class UARTDevice: Returns: Bytes returned from the device. """ - pass def write(self, data: bytes) -> None: """write(data) @@ -263,7 +244,6 @@ class UARTDevice: Arguments: data (bytes): Bytes to be written. """ - pass def waiting(self) -> int: """waiting() -> int @@ -273,13 +253,11 @@ class UARTDevice: Returns: Number of bytes in the buffer. """ - pass def clear(self) -> None: """clear() Empties the buffer.""" - pass class LWP3Device: diff --git a/src/pybricks/media/ev3dev.py b/src/pybricks/media/ev3dev.py index f0c4623..5a5f9d1 100644 --- a/src/pybricks/media/ev3dev.py +++ b/src/pybricks/media/ev3dev.py @@ -55,7 +55,6 @@ class Image: bottom-right coordinates in the ``source`` image that will be used as the bounds for the sub-image. """ - pass @property def width(self) -> int: @@ -73,7 +72,6 @@ class Image: Clears |this image|. All pixels on |this image| will be set to :attr:`Color.WHITE `. """ - pass def draw_pixel(self, x: int, y: int, color: Color = Color.BLACK) -> None: """draw_pixel(x, y, color=Color.BLACK) @@ -85,7 +83,6 @@ class Image: y (int): The y coordinate of the pixel. color (Color): The color of the pixel. """ - pass def draw_line( self, @@ -108,7 +105,6 @@ class Image: width (int): The width of the line in pixels. color (Color): The color of the line. """ - pass def draw_box( self, @@ -134,7 +130,6 @@ class Image: otherwise only the outline of the box will be drawn. color (Color): The color of the box. """ - pass def draw_circle( self, x: int, y: int, r: int, fill: bool = False, color: Color = Color.BLACK @@ -151,7 +146,6 @@ class Image: ``color``, otherwise only the circumference will be drawn. color (Color): The color of the circle. """ - pass def draw_image( self, @@ -220,7 +214,6 @@ class Image: The color used to fill the rectangle behind the text or ``None`` for transparent background. """ - pass def print(self, *args: Any, sep: str = " ", end: str = "\n") -> None: """print(*args, sep=" ", end="\\n") @@ -247,7 +240,6 @@ class Image: is printed. end (str): End of line that will be printed after the last object. """ - pass def set_font(self, font: Font) -> None: """set_font(font) @@ -260,7 +252,6 @@ class Image: font (Font): The font to use. """ - pass @staticmethod def empty(width: int = 178, height: int = 128) -> Image: diff --git a/src/pybricks/nxtdevices.py b/src/pybricks/nxtdevices.py index 543f26c..835b8fc 100644 --- a/src/pybricks/nxtdevices.py +++ b/src/pybricks/nxtdevices.py @@ -22,7 +22,6 @@ class TouchSensor: Arguments: port (Port): Port to which the sensor is connected. """ - pass def pressed(self) -> bool: """pressed() -> bool @@ -33,7 +32,6 @@ class TouchSensor: ``True`` if the sensor is pressed, ``False`` if it is not pressed. """ - pass class LightSensor: @@ -45,7 +43,6 @@ class LightSensor: Arguments: port (Port): Port to which the sensor is connected. """ - pass def ambient(self) -> int: """ambient() -> int: % @@ -55,7 +52,6 @@ class LightSensor: Returns: Ambient light intensity, ranging from 0% (dark) to 100% (bright). """ - pass def reflection(self) -> int: """reflection() -> int: % @@ -66,7 +62,6 @@ class LightSensor: Reflection, ranging from 0% (no reflection) to 100% (high reflection). """ - pass class ColorSensor(CommonColorSensor): @@ -82,7 +77,6 @@ class ColorSensor(CommonColorSensor): Tuple of reflections for red, green, and blue light, each ranging from 0.0% (no reflection) to 100.0% (high reflection). """ - pass class UltrasonicSensor: @@ -94,7 +88,6 @@ class UltrasonicSensor: Arguments: port (Port): Port to which the sensor is connected. """ - pass def distance(self) -> int: """distance() -> int: mm @@ -105,7 +98,6 @@ class UltrasonicSensor: Returns: Measured distance. """ - pass class SoundSensor: @@ -117,7 +109,6 @@ class SoundSensor: Arguments: port (Port): Port to which the sensor is connected. """ - pass def intensity(self, audible_only: bool = True) -> int: """intensity(audible_only=True) -> int: % @@ -132,7 +123,6 @@ class SoundSensor: Returns: Sound intensity. """ - pass class TemperatureSensor: @@ -144,7 +134,6 @@ class TemperatureSensor: Arguments: port (Port): Port to which the sensor is connected. """ - pass def temperature(self) -> int: """temperature() -> float: °C @@ -154,7 +143,6 @@ class TemperatureSensor: Returns: Measured temperature. """ - pass class EnergyMeter: @@ -166,7 +154,6 @@ class EnergyMeter: Arguments: port (Port): Port to which the sensor is connected. """ - pass def storage(self) -> int: """storage() -> int: J @@ -176,7 +163,6 @@ class EnergyMeter: Returns: Remaining stored energy. """ - pass def input(self) -> Tuple[int, int, int]: """input() -> Tuple[int, int, int] @@ -192,7 +178,6 @@ class EnergyMeter: Voltage (mV), current (mA), and power (mW) measured at the input port. """ - pass def output(self) -> Tuple[int, int, int]: """output() -> Tuple[int, int, int] @@ -208,7 +193,6 @@ class EnergyMeter: Voltage (mV), current (mA), and power (mW) measured at the output port. """ - pass class VernierAdapter(AnalogSensor): @@ -225,7 +209,6 @@ class VernierAdapter(AnalogSensor): own conversion function. The example given below demonstrates the conversion for the Surface Temperature Sensor. """ - pass def voltage(self) -> int: """voltage() -> int: mV @@ -235,7 +218,6 @@ class VernierAdapter(AnalogSensor): Returns: Analog voltage. """ - pass def conversion(self, voltage: int) -> float: """conversion(voltage) -> float @@ -251,7 +233,6 @@ class VernierAdapter(AnalogSensor): Returns: Converted sensor value. """ - pass def value(self) -> float: """value() -> float @@ -262,4 +243,3 @@ class VernierAdapter(AnalogSensor): Returns: Converted sensor value. """ - pass diff --git a/src/pybricks/pupdevices.py b/src/pybricks/pupdevices.py index ba1b82b..1486f03 100644 --- a/src/pybricks/pupdevices.py +++ b/src/pybricks/pupdevices.py @@ -36,7 +36,6 @@ class Motor(_Motor): Arguments: angle (Number, deg): Value to which the angle should be reset. """ - pass class Remote: @@ -70,7 +69,6 @@ class Remote: the hub connects to the first remote that it finds. timeout (Number, ms): How long to search for the remote. """ - pass @overload def name(self, name: str) -> None: @@ -101,7 +99,6 @@ class TiltSensor: Arguments: port (Port): Port to which the sensor is connected. """ - pass def tilt(self) -> Tuple[int, int]: """tilt() -> Tuple[int, int]: deg @@ -111,7 +108,6 @@ class TiltSensor: Returns: Tuple of pitch and roll angles. """ - pass class ColorDistanceSensor(CommonColorSensor): @@ -128,7 +124,6 @@ class ColorDistanceSensor(CommonColorSensor): Returns: Distance ranging from 0% (closest) to 100% (farthest). """ - pass class PFMotor(DCMotor): @@ -156,7 +151,6 @@ class PFMotor(DCMotor): positive_direction (Direction): Which direction the motor should turn when you give a positive duty cycle value. """ - pass class ColorSensor(AmbientColorSensor): @@ -177,7 +171,6 @@ class UltrasonicSensor: port (Port): Port to which the sensor is connected. """ - pass def distance(self) -> int: """distance() -> int: mm @@ -190,7 +183,6 @@ class UltrasonicSensor: it returns 2000 mm. """ - pass def presence(self) -> bool: """presence() -> bool @@ -201,7 +193,6 @@ class UltrasonicSensor: Returns: ``True`` if ultrasonic sounds are detected, ``False`` if not. """ - pass class ForceSensor: @@ -213,7 +204,6 @@ class ForceSensor: Arguments: port (Port): Port to which the sensor is connected. """ - pass def force(self) -> float: """force() -> float: N @@ -258,8 +248,6 @@ class ForceSensor: if it is not. """ - pass - class ColorLightMatrix: """ @@ -305,7 +293,6 @@ class InfraredSensor: Arguments: port (Port): Port to which the sensor is connected. """ - pass def reflection(self) -> int: """reflection() -> int: % @@ -316,7 +303,6 @@ class InfraredSensor: Measured reflection, ranging from 0% (no reflection) to 100% (high reflection). """ - pass def distance(self) -> int: """distance() -> int: % @@ -327,7 +313,6 @@ class InfraredSensor: Returns: Distance ranging from 0% (closest) to 100% (farthest). """ - pass def count(self) -> int: """count() -> int @@ -337,7 +322,6 @@ class InfraredSensor: Returns: Number of objects counted. """ - pass class Light: @@ -349,7 +333,6 @@ class Light: Arguments: port (Port): Port to which the device is connected. """ - pass def on(self, brightness: int = 100) -> None: """on(brightness=100) @@ -365,4 +348,3 @@ class Light: """off() Turns off the light.""" - pass diff --git a/src/pybricks/robotics.py b/src/pybricks/robotics.py index b923efd..c137824 100644 --- a/src/pybricks/robotics.py +++ b/src/pybricks/robotics.py @@ -73,13 +73,11 @@ class DriveBase: speed (Number, mm/s): Speed of the robot. turn_rate (Number, deg/s): Turn rate of the robot. """ - pass def stop(self) -> None: """stop() Stops the robot by letting the motors spin freely.""" - pass def distance(self) -> int: """distance() -> int: mm @@ -89,7 +87,6 @@ class DriveBase: Returns: Driven distance since last reset. """ - pass def angle(self) -> int: """angle() -> int: deg @@ -99,7 +96,6 @@ class DriveBase: Returns: Accumulated angle since last reset. """ - pass def state(self) -> Tuple[int, int, int, int]: """state() -> Tuple[int, int, int, int] @@ -109,13 +105,11 @@ class DriveBase: Returns: Tuple of distance, drive speed, angle, and turn rate of the robot. """ - pass def reset(self) -> None: """reset() Resets the estimated driven distance and angle to 0.""" - pass @overload def settings( @@ -148,7 +142,6 @@ class DriveBase: turn_acceleration (Number, deg/s²): Angular acceleration and deceleration of the robot. """ - pass def straight(self, distance, then=_Stop.HOLD, wait=True) -> None: """straight(distance, then=Stop.HOLD, wait=True) @@ -161,7 +154,6 @@ class DriveBase: wait (bool): Wait for the maneuver to complete before continuing with the rest of the program. """ - pass def turn(self, angle, then=_Stop.HOLD, wait=True) -> None: """turn(angle, then=Stop.HOLD, wait=True) @@ -174,7 +166,6 @@ class DriveBase: wait (bool): Wait for the maneuver to complete before continuing with the rest of the program. """ - pass def curve(self, radius, angle, then=_Stop.HOLD, wait=True) -> None: """curve(radius, angle, then=Stop.HOLD, wait=True) @@ -188,4 +179,3 @@ class DriveBase: wait (bool): Wait for the maneuver to complete before continuing with the rest of the program. """ - pass diff --git a/src/pybricks/tools.py b/src/pybricks/tools.py index 3e8ad71..908cf49 100644 --- a/src/pybricks/tools.py +++ b/src/pybricks/tools.py @@ -14,7 +14,6 @@ def wait(time: int) -> None: Arguments: time (Number, ms): How long to wait. """ - pass class StopWatch: @@ -22,7 +21,7 @@ class StopWatch: feature on your phone.""" def __init__(self): - pass + ... def time(self) -> int: """time() -> int: ms @@ -32,19 +31,16 @@ class StopWatch: Returns: Elapsed time. """ - pass def pause(self) -> None: """pause() Pauses the stopwatch.""" - pass def resume(self) -> None: """resume() Resumes the stopwatch.""" - pass def reset(self) -> None: """reset() @@ -56,7 +52,6 @@ class StopWatch: * If it was paused, it stays paused (but now at 0). * If it was running, it stays running (but starting again from 0). """ - pass class DataLog: @@ -86,7 +81,6 @@ class DataLog: data. If the file does not exist yet, an empty file will be created either way. """ - pass def log(self, *values: Any) -> None: """log(value1, value2, ...) @@ -96,4 +90,3 @@ class DataLog: Arguments: values (object, object, ...): One or more objects or values. """ - pass