Fixed more flake8 and black tests
parent
5c97976f15
commit
651da1c896
|
@ -4,7 +4,6 @@ import pathlib
|
||||||
from mopidy import config, ext
|
from mopidy import config, ext
|
||||||
|
|
||||||
from .pinconfig import PinConfig
|
from .pinconfig import PinConfig
|
||||||
from .rotencoder import RotEncoder
|
|
||||||
|
|
||||||
__version__ = "0.0.2"
|
__version__ = "0.0.2"
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ from .rotencoder import RotEncoder
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class RaspberryGPIOFrontend(pykka.ThreadingActor, core.CoreListener):
|
class RaspberryGPIOFrontend(pykka.ThreadingActor, core.CoreListener):
|
||||||
def __init__(self, config, core):
|
def __init__(self, config, core):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
@ -35,9 +36,9 @@ class RaspberryGPIOFrontend(pykka.ThreadingActor, core.CoreListener):
|
||||||
pull = GPIO.PUD_DOWN
|
pull = GPIO.PUD_DOWN
|
||||||
edge = GPIO.RISING
|
edge = GPIO.RISING
|
||||||
|
|
||||||
if 'rotenc_id' in settings.options:
|
if "rotenc_id" in settings.options:
|
||||||
edge = GPIO.BOTH
|
edge = GPIO.BOTH
|
||||||
rotenc_id = settings.options['rotenc_id']
|
rotenc_id = settings.options["rotenc_id"]
|
||||||
encoder = None
|
encoder = None
|
||||||
if rotenc_id in self.rot_encoders.keys():
|
if rotenc_id in self.rot_encoders.keys():
|
||||||
encoder = self.rot_encoders[rotenc_id]
|
encoder = self.rot_encoders[rotenc_id]
|
||||||
|
@ -67,7 +68,7 @@ class RaspberryGPIOFrontend(pykka.ThreadingActor, core.CoreListener):
|
||||||
def gpio_event(self, pin):
|
def gpio_event(self, pin):
|
||||||
settings = self.pin_settings[pin]
|
settings = self.pin_settings[pin]
|
||||||
event = settings.event
|
event = settings.event
|
||||||
encoder = self.find_pin_rotenc (pin)
|
encoder = self.find_pin_rotenc(pin)
|
||||||
if encoder:
|
if encoder:
|
||||||
event = encoder.get_event()
|
event = encoder.get_event()
|
||||||
|
|
||||||
|
|
|
@ -216,8 +216,8 @@ def test_frontend_rot_encoder_event(patched_input):
|
||||||
frontend.dispatch_input = dispatch_input
|
frontend.dispatch_input = dispatch_input
|
||||||
|
|
||||||
frontend.gpio_event(4)
|
frontend.gpio_event(4)
|
||||||
assert (dispatch_input.call_args[0][0] == "volume_up")
|
assert dispatch_input.call_args[0][0] == "volume_up"
|
||||||
assert (encoder.state == (False, False))
|
assert encoder.state == (False, False)
|
||||||
|
|
||||||
# Check that we do not submit an event for the invalid transition
|
# Check that we do not submit an event for the invalid transition
|
||||||
# (False, False) -> (False, False)
|
# (False, False) -> (False, False)
|
||||||
|
|
Loading…
Reference in New Issue