Use f-strings in integrations starting with "M" (#32271)

* Use f-strings in integrations starting with "M"

* Format mqtt light init with black

* Fix lint error

* Fix pylint error

* Restore constants

* Update homeassistant/components/mqtt/discovery.py

* Update homeassistant/components/mqtt/discovery.py

* Update homeassistant/components/mqtt/discovery.py

* Update homeassistant/components/mqtt/discovery.py

* Format with Black
This commit is contained in:
springstan authored and GitHub committed 2020-03-10 23:34:54 +01:00
1 parent bbe0f75336
commit ba0aaeeddb
34 files changed
+62 -80

No files matched your search

+4 -3
View File
@@ -437,8 +437,9 @@ async def async_subscribe(
topic,
catch_log_exception(
wrapped_msg_callback,
lambda msg: "Exception in {} when handling msg on '{}': '{}'".format(
msg_callback.__name__, msg.topic, msg.payload
lambda msg: (
f"Exception in {msg_callback.__name__} when handling msg on "
f"'{msg.topic}': '{msg.payload}'"
),
),
qos,
@@ -1014,7 +1015,7 @@ def _raise_on_error(result_code: int) -> None:
if result_code != 0:
raise HomeAssistantError(
"Error talking to MQTT: {}".format(mqtt.error_string(result_code))
f"Error talking to MQTT: {mqtt.error_string(result_code)}"
)