Skip to content

Commit 9c89de1

Browse files
committed
refactor(assets): Removed the major issues parameter from the operational lifetime
Signed-off-by: eduardiazf <[email protected]>
1 parent 0da71a4 commit 9c89de1

File tree

1 file changed

+5
-15
lines changed

1 file changed

+5
-15
lines changed

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

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,7 @@ def component_connection_from_proto_with_issues(
7373
)
7474
return None
7575

76-
lifetime = _get_operational_lifetime_from_proto(
77-
message, major_issues=major_issues, minor_issues=minor_issues
78-
)
76+
lifetime = _get_operational_lifetime_from_proto(message, minor_issues=minor_issues)
7977

8078
return ComponentConnection(
8179
source=source_component_id,
@@ -87,20 +85,12 @@ def component_connection_from_proto_with_issues(
8785
def _get_operational_lifetime_from_proto(
8886
message: electrical_components_pb2.ElectricalComponentConnection,
8987
*,
90-
major_issues: list[str],
9188
minor_issues: list[str],
9289
) -> Lifetime:
9390
"""Get the operational lifetime from a protobuf message."""
9491
if message.HasField("operational_lifetime"):
95-
try:
96-
return lifetime_from_proto(message.operational_lifetime)
97-
except ValueError as exc:
98-
major_issues.append(
99-
f"invalid operational lifetime ({exc}), considering it as missing "
100-
"(i.e. always operational)",
101-
)
102-
else:
103-
minor_issues.append(
104-
"missing operational lifetime, considering it always operational",
105-
)
92+
return lifetime_from_proto(message.operational_lifetime)
93+
minor_issues.append(
94+
"missing operational lifetime, considering it always operational",
95+
)
10696
return Lifetime()

0 commit comments

Comments
 (0)