Skip to content

Commit 6017e47

Browse files
committed
Rename loop variables when processing state categories
Signed-off-by: Sahas Subramanian <[email protected]>
1 parent 1f59c20 commit 6017e47

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/frequenz/client/reporting/_types.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,15 +113,15 @@ def __iter__(self) -> Iterator[MetricSample]:
113113

114114
for state in getattr(item, "states", []):
115115
ts = state.sampled_at.ToDatetime().replace(tzinfo=timezone.utc)
116-
for name, category in {
116+
for category, category_items in {
117117
"state": getattr(state, "states", []),
118118
"warning": getattr(state, "warnings", []),
119119
"error": getattr(state, "errors", []),
120120
}.items():
121-
if not isinstance(category, Iterable):
121+
if not isinstance(category_items, Iterable):
122122
continue
123-
for s in category:
124-
yield MetricSample(ts, mid, cid, name, s)
123+
for s in category_items:
124+
yield MetricSample(ts, mid, cid, category, s)
125125

126126

127127
@dataclass(frozen=True)

0 commit comments

Comments
 (0)