From f9b2e33b89f01877101e139893ddfcb0e9b3aca9 Mon Sep 17 00:00:00 2001 From: Jelle van der Waa Date: Thu, 22 Aug 2024 16:34:10 +0200 Subject: [PATCH] typing strikes again --- src/cockpit/channels/pcp.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/cockpit/channels/pcp.py b/src/cockpit/channels/pcp.py index 1f2a62b0e10..60344a63fdb 100644 --- a/src/cockpit/channels/pcp.py +++ b/src/cockpit/channels/pcp.py @@ -71,7 +71,7 @@ import sys import time from collections import defaultdict -from typing import TYPE_CHECKING, Any, Iterable, List, NamedTuple, Optional, Sequence +from typing import TYPE_CHECKING, Any, Dict, Iterable, List, NamedTuple, Optional, Sequence from cockpit.protocol import CockpitProblem @@ -92,7 +92,7 @@ class MetricNotFoundError(CockpitProblem): pass -class PcpMetricInfo(dict[str, JsonValue]): +class PcpMetricInfo(Dict[str, JsonValue]): def __init__(self, value: JsonObject) -> None: self.name = get_str(value, 'name') self.derive = get_str(value, 'derive', '') @@ -466,11 +466,11 @@ def sample(self, context: 'pmapi.pmContext', archive_batch: int, limit: int, tot def parse_fetched_results(self, context: 'pmapi.pmContext', results: Any) -> Any: metrics = list(self.metrics) - samples: dict[str, float | list[float]] = {} + samples: Dict[str, float | list[float]] = {} samples['timestamp'] = float(results.contents.timestamp) for i in range(results.contents.numpmid): - values: Optional[dict[str, float] | float] = defaultdict() + values: Optional[Dict[str, float] | float] = defaultdict() numval: int = results.contents.get_numval(i) metric_desc = self.metric_descriptions[i] content_type = metric_desc.desc.type