Refactor list_entities_services to reduce local variables

This commit is contained in:
J. Nick Koston 2023-11-28 08:51:19 -06:00
parent 66e2967694
commit 8fd15a3c57
No known key found for this signature in database
1 changed files with 2 additions and 3 deletions

View File

@ -402,9 +402,8 @@ class APIClient:
if type(msg) is ListEntitiesServicesResponse:
services.append(UserService.from_pb(msg))
continue
cls = response_types[type(msg)]
assert cls is not None
entities.append(cls.from_pb(msg))
if cls := response_types[type(msg)]:
entities.append(cls.from_pb(msg))
return entities, services
async def subscribe_states(self, on_state: Callable[[EntityState], None]) -> None: