pyupgrade --py37-plus **/*.py

remotes/origin/python3
Phil Howard 2019-11-21 18:11:43 +00:00
parent d6df8e5726
commit ba32cf7df8
5 changed files with 6 additions and 14 deletions

View File

@ -1,5 +1,3 @@
from __future__ import unicode_literals
import logging
import os
@ -24,9 +22,9 @@ class Extension(ext.Extension):
return config.read(conf_file)
def get_config_schema(self):
schema = super(Extension, self).get_config_schema()
schema = super().get_config_schema()
for pin in range(28):
schema["bcm{:d}".format(pin)] = PinConfig()
schema[f"bcm{pin:d}"] = PinConfig()
return schema
def setup(self, registry):

View File

@ -1,5 +1,3 @@
from __future__ import unicode_literals
import logging
from mopidy import core
@ -12,7 +10,7 @@ logger = logging.getLogger(__name__)
class RaspberryGPIOFrontend(pykka.ThreadingActor, core.CoreListener):
def __init__(self, config, core):
super(RaspberryGPIOFrontend, self).__init__()
super().__init__()
import RPi.GPIO as GPIO
self.core = core
self.config = config["raspberry-gpio"]
@ -54,12 +52,12 @@ class RaspberryGPIOFrontend(pykka.ThreadingActor, core.CoreListener):
self.dispatch_input(settings.event)
def dispatch_input(self, event):
handler_name = "handle_{}".format(event)
handler_name = f"handle_{event}"
try:
getattr(self, handler_name)()
except AttributeError:
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):

View File

@ -43,7 +43,7 @@ class PinConfig(config.ConfigValue):
bouncetime = int(bouncetime)
except 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)

View File

@ -1,5 +1,3 @@
from __future__ import unicode_literals
import pytest
from mopidy_raspberry_gpio import Extension, PinConfig

View File

@ -1,5 +1,3 @@
from __future__ import unicode_literals
import sys
import mock