Fixed more flake8 and black tests

rotencoder
Martin Felis 2021-03-14 13:09:28 +01:00
parent 5c97976f15
commit 651da1c896
3 changed files with 6 additions and 6 deletions

View File

@ -4,7 +4,6 @@ import pathlib
from mopidy import config, ext
from .pinconfig import PinConfig
from .rotencoder import RotEncoder
__version__ = "0.0.2"

View File

@ -7,6 +7,7 @@ from .rotencoder import RotEncoder
logger = logging.getLogger(__name__)
class RaspberryGPIOFrontend(pykka.ThreadingActor, core.CoreListener):
def __init__(self, config, core):
super().__init__()
@ -35,9 +36,9 @@ class RaspberryGPIOFrontend(pykka.ThreadingActor, core.CoreListener):
pull = GPIO.PUD_DOWN
edge = GPIO.RISING
if 'rotenc_id' in settings.options:
if "rotenc_id" in settings.options:
edge = GPIO.BOTH
rotenc_id = settings.options['rotenc_id']
rotenc_id = settings.options["rotenc_id"]
encoder = None
if rotenc_id in self.rot_encoders.keys():
encoder = self.rot_encoders[rotenc_id]
@ -67,7 +68,7 @@ class RaspberryGPIOFrontend(pykka.ThreadingActor, core.CoreListener):
def gpio_event(self, pin):
settings = self.pin_settings[pin]
event = settings.event
encoder = self.find_pin_rotenc (pin)
encoder = self.find_pin_rotenc(pin)
if encoder:
event = encoder.get_event()

View File

@ -216,8 +216,8 @@ def test_frontend_rot_encoder_event(patched_input):
frontend.dispatch_input = dispatch_input
frontend.gpio_event(4)
assert (dispatch_input.call_args[0][0] == "volume_up")
assert (encoder.state == (False, False))
assert dispatch_input.call_args[0][0] == "volume_up"
assert encoder.state == (False, False)
# Check that we do not submit an event for the invalid transition
# (False, False) -> (False, False)