mirror of
https://github.com/pimoroni/grow-python
synced 2025-10-25 15:19:23 +00:00
QA: Fix ruff suggestions.
This commit is contained in:
@@ -2,7 +2,6 @@
|
|||||||
import logging
|
import logging
|
||||||
import math
|
import math
|
||||||
import pathlib
|
import pathlib
|
||||||
import random
|
|
||||||
import sys
|
import sys
|
||||||
import threading
|
import threading
|
||||||
import time
|
import time
|
||||||
@@ -132,7 +131,6 @@ class View:
|
|||||||
|
|
||||||
# Given a rectangle, reflow and scale text to fit, centred
|
# Given a rectangle, reflow and scale text to fit, centred
|
||||||
while font.size > 0:
|
while font.size > 0:
|
||||||
space_width = font.getsize(" ")[0]
|
|
||||||
line_height = int(font.size * line_spacing)
|
line_height = int(font.size * line_spacing)
|
||||||
max_lines = math.floor(height / line_height)
|
max_lines = math.floor(height / line_height)
|
||||||
lines = []
|
lines = []
|
||||||
@@ -193,7 +191,6 @@ class MainView(View):
|
|||||||
bar_margin = 2
|
bar_margin = 2
|
||||||
bar_width = 30
|
bar_width = 30
|
||||||
label_width = 16
|
label_width = 16
|
||||||
label_height = 16
|
|
||||||
label_y = 0
|
label_y = 0
|
||||||
|
|
||||||
x = [
|
x = [
|
||||||
@@ -688,14 +685,12 @@ class Channel:
|
|||||||
self._dry_point = dry_point
|
self._dry_point = dry_point
|
||||||
self.sensor.set_dry_point(dry_point)
|
self.sensor.set_dry_point(dry_point)
|
||||||
|
|
||||||
def warn_color(self):
|
|
||||||
value = self.sensor.moisture
|
|
||||||
|
|
||||||
def indicator_color(self, value):
|
def indicator_color(self, value):
|
||||||
value = 1.0 - value
|
value = 1.0 - value
|
||||||
|
|
||||||
if value == 1.0:
|
if value == 1.0:
|
||||||
return self.colors[-1]
|
return self.colors[-1]
|
||||||
|
|
||||||
if value == 0.0:
|
if value == 0.0:
|
||||||
return self.colors[0]
|
return self.colors[0]
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import time
|
|||||||
|
|
||||||
|
|
||||||
def test_pumps_actually_stop(GPIO, smbus):
|
def test_pumps_actually_stop(GPIO, smbus):
|
||||||
from grow.pump import Pump, global_lock
|
from grow.pump import Pump
|
||||||
|
|
||||||
ch1 = Pump(channel=1)
|
ch1 = Pump(channel=1)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user