Make use of str.removeprefix and .removesuffix (#85584)

This commit is contained in:
Ville Skyttä 2023-01-13 13:19:38 +02:00 committed by GitHub
parent d44210e573
commit ae302bbec0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 33 additions and 52 deletions

View file

@ -17,9 +17,7 @@ def async_describe_events(hass, async_describe_event):
commands = []
for command_payload in event.data["execution"]:
command = command_payload["command"]
if command.startswith(COMMON_COMMAND_PREFIX):
command = command[len(COMMON_COMMAND_PREFIX) :]
command = command_payload["command"].removeprefix(COMMON_COMMAND_PREFIX)
commands.append(command)
message = f"sent command {', '.join(commands)}"