diff --git a/prometheus_client/core.py b/prometheus_client/core.py index 9e45e157..9e5994d6 100644 --- a/prometheus_client/core.py +++ b/prometheus_client/core.py @@ -537,11 +537,11 @@ def labels(self, *labelvalues, **labelkwargs): if labelkwargs: if sorted(labelkwargs) != sorted(self._labelnames): raise ValueError('Incorrect label names') - labelvalues = tuple([unicode(labelkwargs[l]) for l in self._labelnames]) + labelvalues = tuple(unicode(labelkwargs[l]) for l in self._labelnames) else: if len(labelvalues) != len(self._labelnames): raise ValueError('Incorrect label count') - labelvalues = tuple([unicode(l) for l in labelvalues]) + labelvalues = tuple(unicode(l) for l in labelvalues) with self._lock: if labelvalues not in self._metrics: self._metrics[labelvalues] = self._wrappedClass(self._name, self._labelnames, labelvalues, **self._kwargs) @@ -551,7 +551,7 @@ def remove(self, *labelvalues): '''Remove the given labelset from the metric.''' if len(labelvalues) != len(self._labelnames): raise ValueError('Incorrect label count') - labelvalues = tuple([unicode(l) for l in labelvalues]) + labelvalues = tuple(unicode(l) for l in labelvalues) with self._lock: del self._metrics[labelvalues] @@ -559,7 +559,7 @@ def _samples(self): with self._lock: metrics = self._metrics.copy() for labels, metric in metrics.items(): - series_labels = list(dict(zip(self._labelnames, labels)).items()) + series_labels = list(zip(self._labelnames, labels)) for suffix, sample_labels, value in metric._samples(): yield (suffix, dict(series_labels + list(sample_labels.items())), value)