From ba32cf7df882fa7492b1da0a60c65a70bd339212 Mon Sep 17 00:00:00 2001 From: Phil Howard Date: Thu, 21 Nov 2019 18:11:43 +0000 Subject: [PATCH] pyupgrade --py37-plus **/*.py --- mopidy_raspberry_gpio/__init__.py | 6 ++---- mopidy_raspberry_gpio/frontend.py | 8 +++----- mopidy_raspberry_gpio/pinconfig.py | 2 +- tests/test_config.py | 2 -- tests/test_frontend.py | 2 -- 5 files changed, 6 insertions(+), 14 deletions(-) diff --git a/mopidy_raspberry_gpio/__init__.py b/mopidy_raspberry_gpio/__init__.py index 2187c7f..f449cb7 100644 --- a/mopidy_raspberry_gpio/__init__.py +++ b/mopidy_raspberry_gpio/__init__.py @@ -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): diff --git a/mopidy_raspberry_gpio/frontend.py b/mopidy_raspberry_gpio/frontend.py index 829f0b7..2be9e50 100644 --- a/mopidy_raspberry_gpio/frontend.py +++ b/mopidy_raspberry_gpio/frontend.py @@ -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): diff --git a/mopidy_raspberry_gpio/pinconfig.py b/mopidy_raspberry_gpio/pinconfig.py index e8a8942..9e59ebc 100644 --- a/mopidy_raspberry_gpio/pinconfig.py +++ b/mopidy_raspberry_gpio/pinconfig.py @@ -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) diff --git a/tests/test_config.py b/tests/test_config.py index c363999..467a8c7 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import pytest from mopidy_raspberry_gpio import Extension, PinConfig diff --git a/tests/test_frontend.py b/tests/test_frontend.py index 60105b8..f3a1f3f 100644 --- a/tests/test_frontend.py +++ b/tests/test_frontend.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import sys import mock