Skip to content

Commit b5e92be

Browse files
committed
refactor(assets): Refactors list_microgrid_electrical_component_connections
To use map/filter for cleaner logic and to skip invalid connections. Signed-off-by: eduardiazf <[email protected]>
1 parent f95d838 commit b5e92be

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/frequenz/client/assets/_client.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,9 @@ async def list_microgrid_electrical_component_connections(
175175
method_name="ListMicrogridElectricalComponentConnections",
176176
)
177177

178-
return [
179-
component_connection_from_proto(connection)
180-
for connection in response.connections
181-
]
178+
return list(
179+
map(
180+
component_connection_from_proto,
181+
filter(bool, response.connections),
182+
)
183+
)

0 commit comments

Comments
 (0)