Refactor list_entities_services to reduce local variables

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

View File

@ -399,10 +399,11 @@ class APIClient:
services: list[UserService] = []
response_types = LIST_ENTITIES_SERVICES_RESPONSE_TYPES
for msg in msgs:
if type(msg) is ListEntitiesServicesResponse:
msg_type = type(msg)
if msg_type is ListEntitiesServicesResponse:
services.append(UserService.from_pb(msg))
continue
if cls := response_types[type(msg)]:
if cls := response_types[msg_type]:
entities.append(cls.from_pb(msg))
return entities, services