From 6ed6ec03781b40d3a356a2f308a64e58da38d750 Mon Sep 17 00:00:00 2001 From: David Lechner Date: Thu, 12 Mar 2020 12:46:09 -0500 Subject: [PATCH] api: remove empty () on class declarations Python allows this syntax and some even consider it good style. --- pybricks/builtins.py | 20 ++++++++++---------- pybricks/ev3devices.py | 10 +++++----- pybricks/hubs.py | 4 ++-- pybricks/iodevices.py | 10 +++++----- pybricks/media/ev3dev.py | 4 ++-- pybricks/nxtdevices.py | 14 +++++++------- pybricks/pupdevices.py | 4 ++-- pybricks/robotics.py | 2 +- pybricks/tools.py | 4 ++-- 9 files changed, 36 insertions(+), 36 deletions(-) diff --git a/pybricks/builtins.py b/pybricks/builtins.py index 9e0dc4c..00bb9f1 100644 --- a/pybricks/builtins.py +++ b/pybricks/builtins.py @@ -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): diff --git a/pybricks/ev3devices.py b/pybricks/ev3devices.py index 76bf181..d2cec57 100644 --- a/pybricks/ev3devices.py +++ b/pybricks/ev3devices.py @@ -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): diff --git a/pybricks/hubs.py b/pybricks/hubs.py index 1fb414e..d5515d1 100644 --- a/pybricks/hubs.py +++ b/pybricks/hubs.py @@ -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() diff --git a/pybricks/iodevices.py b/pybricks/iodevices.py index 499b6db..af0d3c7 100644 --- a/pybricks/iodevices.py +++ b/pybricks/iodevices.py @@ -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): diff --git a/pybricks/media/ev3dev.py b/pybricks/media/ev3dev.py index dee1869..8e77d39 100644 --- a/pybricks/media/ev3dev.py +++ b/pybricks/media/ev3dev.py @@ -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/' diff --git a/pybricks/nxtdevices.py b/pybricks/nxtdevices.py index ef6b6f5..1306bbc 100644 --- a/pybricks/nxtdevices.py +++ b/pybricks/nxtdevices.py @@ -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): diff --git a/pybricks/pupdevices.py b/pybricks/pupdevices.py index 764bf0e..17ec93d 100644 --- a/pybricks/pupdevices.py +++ b/pybricks/pupdevices.py @@ -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() diff --git a/pybricks/robotics.py b/pybricks/robotics.py index 6893716..b2d8daa 100644 --- a/pybricks/robotics.py +++ b/pybricks/robotics.py @@ -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.""" diff --git a/pybricks/tools.py b/pybricks/tools.py index 02cb347..acb3d13 100644 --- a/pybricks/tools.py +++ b/pybricks/tools.py @@ -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'):