Skip to content

Commit 2a5210b

Browse files
committed
Disable too-many-branches check for component proto
When converting electrical components from protobuf, we have a big match statement to dispatch the different component categories to the right conversion function. It is fine in this case to have a lot of branching. The alternative would be to do a dict-based dispatch but we lose exhaustiveness checks, or we need to use a typed-dict, adding unnecessary complexity. Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
1 parent 7f3973e commit 2a5210b

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/frequenz/client/assets/electrical_component/_electrical_component_proto.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,10 @@ def component_base_from_proto_with_issues(
172172
)
173173

174174

175+
# This function is just a big match statement to dispatch to the right component
176+
# class based on the category and subcategory, so it's fine to have many branches
177+
# here.
178+
# pylint: disable-next=too-many-branches
175179
def electrical_component_from_proto_with_issues(
176180
message: electrical_components_pb2.ElectricalComponent,
177181
*,

0 commit comments

Comments
 (0)