mirror of
https://github.com/pybricks/pybricks-api.git
synced 2026-09-12 01:24:17 +00:00
api: remove empty () on class declarations
Python allows this syntax and some even consider it good style.
This commit is contained in:
+10
-10
@@ -7,7 +7,7 @@ speakers, and batteries."""
|
||||
from .parameters import Direction, Stop, Axis
|
||||
|
||||
|
||||
class DCMotor():
|
||||
class DCMotor:
|
||||
"""Generic class to control simple motors without rotation sensors, such
|
||||
as train motors."""
|
||||
|
||||
@@ -31,7 +31,7 @@ class DCMotor():
|
||||
pass
|
||||
|
||||
|
||||
class Control():
|
||||
class Control:
|
||||
"""Class to interact with PID controller and settings.
|
||||
|
||||
.. data:: scale
|
||||
@@ -293,7 +293,7 @@ class Motor(DCMotor):
|
||||
"""
|
||||
|
||||
|
||||
class Speaker():
|
||||
class Speaker:
|
||||
"""Play beeps and sounds using a speaker."""
|
||||
|
||||
def beep(self, frequency=500, duration=100):
|
||||
@@ -384,7 +384,7 @@ class Speaker():
|
||||
pass
|
||||
|
||||
|
||||
class Light():
|
||||
class Light:
|
||||
"""Control a single-color light."""
|
||||
|
||||
def on(self, brightness=100):
|
||||
@@ -400,7 +400,7 @@ class Light():
|
||||
pass
|
||||
|
||||
|
||||
class ColorLight():
|
||||
class ColorLight:
|
||||
"""Control a multi-color light."""
|
||||
|
||||
def on(self, color):
|
||||
@@ -427,7 +427,7 @@ class ColorLight():
|
||||
pass
|
||||
|
||||
|
||||
class LightArray():
|
||||
class LightArray:
|
||||
"""Control an array of single-color lights."""
|
||||
|
||||
def __init__(self, lights):
|
||||
@@ -463,7 +463,7 @@ class LightArray():
|
||||
pass
|
||||
|
||||
|
||||
class LightGrid():
|
||||
class LightGrid:
|
||||
"""Control a rectangular grid of single-color lights."""
|
||||
|
||||
def __init__(self, rows, columns):
|
||||
@@ -540,7 +540,7 @@ class LightGrid():
|
||||
pass
|
||||
|
||||
|
||||
class KeyPad():
|
||||
class KeyPad:
|
||||
"""Get status of buttons on a keypad layout."""
|
||||
|
||||
def pressed(self):
|
||||
@@ -553,7 +553,7 @@ class KeyPad():
|
||||
pass
|
||||
|
||||
|
||||
class Battery():
|
||||
class Battery:
|
||||
"""Get the status of a battery."""
|
||||
|
||||
def voltage(self):
|
||||
@@ -574,7 +574,7 @@ class Battery():
|
||||
pass
|
||||
|
||||
|
||||
class Accelerometer():
|
||||
class Accelerometer:
|
||||
"""Get measurements from an accelerometer."""
|
||||
|
||||
def neutral(self, top, front):
|
||||
|
||||
@@ -7,7 +7,7 @@ from .parameters import Direction
|
||||
from .builtins import Motor # noqa E402
|
||||
|
||||
|
||||
class TouchSensor():
|
||||
class TouchSensor:
|
||||
"""LEGO® MINDSTORMS® EV3 Touch Sensor."""
|
||||
|
||||
def __init__(self, port):
|
||||
@@ -29,7 +29,7 @@ class TouchSensor():
|
||||
pass
|
||||
|
||||
|
||||
class ColorSensor():
|
||||
class ColorSensor:
|
||||
"""LEGO® MINDSTORMS® EV3 Color Sensor."""
|
||||
|
||||
def __init__(self, port):
|
||||
@@ -84,7 +84,7 @@ class ColorSensor():
|
||||
pass
|
||||
|
||||
|
||||
class InfraredSensor():
|
||||
class InfraredSensor:
|
||||
"""LEGO® MINDSTORMS® EV3 Infrared Sensor and Beacon."""
|
||||
|
||||
def __init__(self, port):
|
||||
@@ -151,7 +151,7 @@ class InfraredSensor():
|
||||
pass
|
||||
|
||||
|
||||
class GyroSensor():
|
||||
class GyroSensor:
|
||||
"""LEGO® MINDSTORMS® EV3 Gyro Sensor."""
|
||||
|
||||
def __init__(self, port, positive_direction=Direction.CLOCKWISE):
|
||||
@@ -208,7 +208,7 @@ class GyroSensor():
|
||||
pass
|
||||
|
||||
|
||||
class UltrasonicSensor():
|
||||
class UltrasonicSensor:
|
||||
"""LEGO® MINDSTORMS® EV3 Ultrasonic Sensor."""
|
||||
|
||||
def __init__(self, port):
|
||||
|
||||
+2
-2
@@ -17,14 +17,14 @@ class EV3Brick:
|
||||
buttons = KeyPad()
|
||||
|
||||
|
||||
class MoveHub():
|
||||
class MoveHub:
|
||||
"""LEGO® Powered Up Move Hub."""
|
||||
Port = Enum('Port', ['A', 'B', 'C', 'D'])
|
||||
battery = Battery()
|
||||
light = ColorLight()
|
||||
|
||||
|
||||
class CityHub():
|
||||
class CityHub:
|
||||
"""LEGO® Powered Up City Hub."""
|
||||
Port = Enum('Port', ['A', 'B'])
|
||||
battery = Battery()
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"""Generic input/output devices."""
|
||||
|
||||
|
||||
class LUMPDevice():
|
||||
class LUMPDevice:
|
||||
"""Devices using the LEGO UART Messaging Protocol."""
|
||||
|
||||
def __init__(self, port):
|
||||
@@ -37,7 +37,7 @@ class LUMPDevice():
|
||||
pass
|
||||
|
||||
|
||||
class Ev3devSensor():
|
||||
class Ev3devSensor:
|
||||
"""Read values of an ev3dev-compatible sensor."""
|
||||
|
||||
sensor_index = 0
|
||||
@@ -66,7 +66,7 @@ class Ev3devSensor():
|
||||
pass
|
||||
|
||||
|
||||
class AnalogSensor():
|
||||
class AnalogSensor:
|
||||
"""Generic or custom analog sensor."""
|
||||
|
||||
def __init__(self, port):
|
||||
@@ -119,7 +119,7 @@ class AnalogSensor():
|
||||
pass
|
||||
|
||||
|
||||
class I2CDevice():
|
||||
class I2CDevice:
|
||||
"""Generic or custom I2C device."""
|
||||
|
||||
def __init__(self, port, address):
|
||||
@@ -156,7 +156,7 @@ class I2CDevice():
|
||||
pass
|
||||
|
||||
|
||||
class UARTDevice():
|
||||
class UARTDevice:
|
||||
"""Generic UART device."""
|
||||
|
||||
def __init__(self, port, baudrate, timeout=None):
|
||||
|
||||
@@ -475,7 +475,7 @@ class Font:
|
||||
Font.DEFAULT = Font('Lucida', 12)
|
||||
|
||||
|
||||
class SoundFile():
|
||||
class SoundFile:
|
||||
"""Paths to standard EV3 sounds."""
|
||||
|
||||
_BASE_PATH = '/usr/share/sounds/ev3dev/'
|
||||
@@ -586,7 +586,7 @@ class SoundFile():
|
||||
OVERPOWER = _BASE_PATH + 'system/overpower.wav'
|
||||
|
||||
|
||||
class ImageFile():
|
||||
class ImageFile:
|
||||
"""Paths to standard EV3 images."""
|
||||
|
||||
_BASE_PATH = '/usr/share/images/ev3dev/mono/'
|
||||
|
||||
@@ -8,7 +8,7 @@ from pybricks.iodevices import AnalogSensor
|
||||
from pybricks.builtins import ColorLight
|
||||
|
||||
|
||||
class TouchSensor():
|
||||
class TouchSensor:
|
||||
"""LEGO® MINDSTORMS® NXT Touch Sensor."""
|
||||
|
||||
def __init__(self, port):
|
||||
@@ -30,7 +30,7 @@ class TouchSensor():
|
||||
pass
|
||||
|
||||
|
||||
class LightSensor():
|
||||
class LightSensor:
|
||||
"""LEGO® MINDSTORMS® NXT Color Sensor."""
|
||||
|
||||
def __init__(self, port):
|
||||
@@ -62,7 +62,7 @@ class LightSensor():
|
||||
pass
|
||||
|
||||
|
||||
class ColorSensor():
|
||||
class ColorSensor:
|
||||
"""LEGO® MINDSTORMS® NXT Color Sensor."""
|
||||
|
||||
light = ColorLight()
|
||||
@@ -119,7 +119,7 @@ class ColorSensor():
|
||||
pass
|
||||
|
||||
|
||||
class UltrasonicSensor():
|
||||
class UltrasonicSensor:
|
||||
"""LEGO® MINDSTORMS® NXT Ultrasonic Sensor."""
|
||||
|
||||
def __init__(self, port):
|
||||
@@ -142,7 +142,7 @@ class UltrasonicSensor():
|
||||
pass
|
||||
|
||||
|
||||
class SoundSensor():
|
||||
class SoundSensor:
|
||||
"""LEGO® MINDSTORMS® NXT Sound Sensor."""
|
||||
|
||||
def __init__(self, port):
|
||||
@@ -169,7 +169,7 @@ class SoundSensor():
|
||||
pass
|
||||
|
||||
|
||||
class TemperatureSensor():
|
||||
class TemperatureSensor:
|
||||
"""LEGO® MINDSTORMS® NXT Ultrasonic Sensor."""
|
||||
|
||||
def __init__(self, port):
|
||||
@@ -191,7 +191,7 @@ class TemperatureSensor():
|
||||
pass
|
||||
|
||||
|
||||
class EnergyMeter():
|
||||
class EnergyMeter:
|
||||
"""LEGO® MINDSTORMS® Education NXT Energy Meter."""
|
||||
|
||||
def __init__(self, port):
|
||||
|
||||
@@ -7,7 +7,7 @@ from .builtins import KeyPad, Accelerometer, ColorLight
|
||||
from .builtins import Motor # noqa E402
|
||||
|
||||
|
||||
class RemoteControl():
|
||||
class RemoteControl:
|
||||
"""LEGO® Powered Up Bluetooth Remote Control/Handset."""
|
||||
|
||||
light = ColorLight()
|
||||
@@ -39,7 +39,7 @@ class TiltSensor(Accelerometer):
|
||||
pass
|
||||
|
||||
|
||||
class ColorDistanceSensor():
|
||||
class ColorDistanceSensor:
|
||||
"""LEGO® Powered Up Color and Distance Sensor."""
|
||||
|
||||
light = ColorLight()
|
||||
|
||||
@@ -7,7 +7,7 @@ from .parameters import Stop
|
||||
from .builtins import Control
|
||||
|
||||
|
||||
class DriveBase():
|
||||
class DriveBase:
|
||||
"""A robotic vehicle with two powered wheels and an optional support
|
||||
wheel or caster."""
|
||||
|
||||
|
||||
+2
-2
@@ -14,7 +14,7 @@ def wait(time):
|
||||
pass
|
||||
|
||||
|
||||
class StopWatch():
|
||||
class StopWatch:
|
||||
"""A stopwatch to measure time intervals. Similar to the stopwatch
|
||||
feature on your phone."""
|
||||
|
||||
@@ -48,7 +48,7 @@ class StopWatch():
|
||||
pass
|
||||
|
||||
|
||||
class DataLog():
|
||||
class DataLog:
|
||||
"""Create a file and log data."""
|
||||
|
||||
def __init__(self, *headers, name='log', timestamp=True, extension='csv'):
|
||||
|
||||
Reference in New Issue
Block a user