diff --git a/mopidy_raspberry_gpio/__init__.py b/mopidy_raspberry_gpio/__init__.py index 93bea71..859f10a 100644 --- a/mopidy_raspberry_gpio/__init__.py +++ b/mopidy_raspberry_gpio/__init__.py @@ -4,7 +4,6 @@ import pathlib from mopidy import config, ext from .pinconfig import PinConfig -from .rotencoder import RotEncoder __version__ = "0.0.2" diff --git a/mopidy_raspberry_gpio/frontend.py b/mopidy_raspberry_gpio/frontend.py index 93475fc..215b9c3 100644 --- a/mopidy_raspberry_gpio/frontend.py +++ b/mopidy_raspberry_gpio/frontend.py @@ -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() diff --git a/tests/test_frontend.py b/tests/test_frontend.py index 0d7db26..568fbe7 100644 --- a/tests/test_frontend.py +++ b/tests/test_frontend.py @@ -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)