From 0bc4d3a030ff933165aae74db8c327281ae65318 Mon Sep 17 00:00:00 2001 From: Phil Howard Date: Thu, 21 Nov 2019 18:31:01 +0000 Subject: [PATCH] Use f-strings instead of % and .format() --- mopidy_raspberry_gpio/pinconfig.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/mopidy_raspberry_gpio/pinconfig.py b/mopidy_raspberry_gpio/pinconfig.py index 9ed9e9c..5f300cb 100644 --- a/mopidy_raspberry_gpio/pinconfig.py +++ b/mopidy_raspberry_gpio/pinconfig.py @@ -26,16 +26,12 @@ class PinConfig(config.ConfigValue): if event not in self.valid_events: raise ValueError( - "invalid event for pin config {:s} (Must be {})".format( - event, ", ".join(self.valid_events) - ) + f"invalid event for pin config {event} (Must be {', '.join(self.valid_events)})" ) if active not in self.valid_modes: raise ValueError( - "invalid mode for pin config {:s} (Must be {})".format( - event, ", ".join(self.valid_events) - ) + f"invalid event for pin config {active} (Must be {', '.join(self.valid_modes)})" ) try: @@ -50,7 +46,5 @@ class PinConfig(config.ConfigValue): def serialize(self, value, display=False): if value is None: return "" - value = "{:s},{:s},{:d}".format( - value.event, value.active, value.bouncetime - ) + value = f"{value.event},{value.active},{value.bouncetime}" return config.encode(value)