mirror of
https://github.com/pybricks/pybricks-api.git
synced 2026-09-11 09:05:07 +00:00
all: Format with black.
Also activate auto formatting. Bump flake8 and mark black disagreements in setup.cfg.
This commit is contained in:
@@ -13,22 +13,22 @@ class MySensor(Ev3devSensor):
|
||||
super().__init__(port)
|
||||
|
||||
# Get the sysfs path.
|
||||
self.path = '/sys/class/lego-sensor/sensor' + str(self.sensor_index)
|
||||
self.path = "/sys/class/lego-sensor/sensor" + str(self.sensor_index)
|
||||
|
||||
def get_modes(self):
|
||||
"""Get a list of mode strings so we don't have to look them up."""
|
||||
|
||||
# The path of the modes file.
|
||||
modes_path = self.path + '/modes'
|
||||
modes_path = self.path + "/modes"
|
||||
|
||||
# Open the modes file.
|
||||
with open(modes_path, 'r') as m:
|
||||
with open(modes_path, "r") as m:
|
||||
|
||||
# Read the contents.
|
||||
contents = m.read()
|
||||
|
||||
# Strip the newline symbol, and split at every space symbol.
|
||||
return contents.strip().split(' ')
|
||||
return contents.strip().split(" ")
|
||||
|
||||
|
||||
# Initialize the sensor
|
||||
|
||||
@@ -10,10 +10,10 @@ sensor = Ev3devSensor(Port.S3)
|
||||
|
||||
while True:
|
||||
# Read the raw RGB values
|
||||
r, g, b = sensor.read('RGB-RAW')
|
||||
r, g, b = sensor.read("RGB-RAW")
|
||||
|
||||
# Print results
|
||||
print('R: {0}\t G: {1}\t B: {2}'.format(r, g, b))
|
||||
print("R: {0}\t G: {1}\t B: {2}".format(r, g, b))
|
||||
|
||||
# Wait
|
||||
wait(200)
|
||||
|
||||
Reference in New Issue
Block a user