Skip to content

Commit 7ea64dd

Browse files
committed
fixup _component_proto.py
1 parent a741cb5 commit 7ea64dd

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/frequenz/client/microgrid/component/_component_proto.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"""Loading of Component objects from protobuf messages."""
55

66
import logging
7-
from typing import Sequence, assert_never
7+
from collections.abc import Sequence
8+
from typing import assert_never
89

910
from frequenz.api.common.v1.microgrid.components import (
1011
battery_pb2,
@@ -167,7 +168,7 @@ def _component_from_proto_with_issues(
167168
if (
168169
metadata_category
169170
and isinstance(category, ComponentCategory)
170-
and _category_matches(metadata_category, category)
171+
and not _category_matches(metadata_category, category)
171172
):
172173
major_issues.append("category_type.metadata does not match the category_type")
173174
return MismatchedCategoryComponent(
@@ -383,7 +384,7 @@ def _category_matches(metadata_category: str, category: ComponentCategory) -> bo
383384
}
384385
cat_name = category.name.lower()
385386
fixed_category = category_to_metadata_name_fixes.get(cat_name, cat_name)
386-
return fixed_category != metadata_category
387+
return fixed_category == metadata_category
387388

388389

389390
def _battery_from_proto(

0 commit comments

Comments
 (0)