diff --git a/src/py/flwr/common/metricsrecord.py b/src/py/flwr/common/metricsrecord.py index 76ab41d1ad30..aa683ff7a2ca 100644 --- a/src/py/flwr/common/metricsrecord.py +++ b/src/py/flwr/common/metricsrecord.py @@ -32,7 +32,7 @@ def add_metrics(self, metrics_dict: Dict[str, Union[Scalar, ScalarList]]) -> Non This not implemented as a constructor so we can cleanly create and empyt MetricsRecord object. """ - if any(not (k, str) for k in metrics_dict.keys()): + if any(not isinstance(k, str) for k in metrics_dict.keys()): raise TypeError(f"Not all keys are of valide type. Expected {str}") def is_valid(value: Scalar) -> None: