pyupgrade --py37-plus **/*.py
parent
d6df8e5726
commit
ba32cf7df8
|
@ -1,5 +1,3 @@
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
@ -24,9 +22,9 @@ class Extension(ext.Extension):
|
||||||
return config.read(conf_file)
|
return config.read(conf_file)
|
||||||
|
|
||||||
def get_config_schema(self):
|
def get_config_schema(self):
|
||||||
schema = super(Extension, self).get_config_schema()
|
schema = super().get_config_schema()
|
||||||
for pin in range(28):
|
for pin in range(28):
|
||||||
schema["bcm{:d}".format(pin)] = PinConfig()
|
schema[f"bcm{pin:d}"] = PinConfig()
|
||||||
return schema
|
return schema
|
||||||
|
|
||||||
def setup(self, registry):
|
def setup(self, registry):
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from mopidy import core
|
from mopidy import core
|
||||||
|
@ -12,7 +10,7 @@ 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(RaspberryGPIOFrontend, self).__init__()
|
super().__init__()
|
||||||
import RPi.GPIO as GPIO
|
import RPi.GPIO as GPIO
|
||||||
self.core = core
|
self.core = core
|
||||||
self.config = config["raspberry-gpio"]
|
self.config = config["raspberry-gpio"]
|
||||||
|
@ -54,12 +52,12 @@ class RaspberryGPIOFrontend(pykka.ThreadingActor, core.CoreListener):
|
||||||
self.dispatch_input(settings.event)
|
self.dispatch_input(settings.event)
|
||||||
|
|
||||||
def dispatch_input(self, event):
|
def dispatch_input(self, event):
|
||||||
handler_name = "handle_{}".format(event)
|
handler_name = f"handle_{event}"
|
||||||
try:
|
try:
|
||||||
getattr(self, handler_name)()
|
getattr(self, handler_name)()
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
raise RuntimeError(
|
raise RuntimeError(
|
||||||
"Could not find input handler for event: {}".format(event)
|
f"Could not find input handler for event: {event}"
|
||||||
)
|
)
|
||||||
|
|
||||||
def handle_play_pause(self):
|
def handle_play_pause(self):
|
||||||
|
|
|
@ -43,7 +43,7 @@ class PinConfig(config.ConfigValue):
|
||||||
bouncetime = int(bouncetime)
|
bouncetime = int(bouncetime)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
"invalid bouncetime value for pin config {}".format(bouncetime)
|
f"invalid bouncetime value for pin config {bouncetime}"
|
||||||
)
|
)
|
||||||
|
|
||||||
return self.tuple_pinconfig(event, active, bouncetime)
|
return self.tuple_pinconfig(event, active, bouncetime)
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from mopidy_raspberry_gpio import Extension, PinConfig
|
from mopidy_raspberry_gpio import Extension, PinConfig
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
|
|
Loading…
Reference in New Issue