client_python icon indicating copy to clipboard operation
client_python copied to clipboard

Increase the usage of augmented assignment statements

Open elfring opened this issue 4 years ago • 0 comments

:eyes: Some source code analysis tools can help to find opportunities for improving software components. :thought_balloon: I propose to increase the usage of augmented assignment statements accordingly.

diff --git a/prometheus_client/exposition.py b/prometheus_client/exposition.py
index e374144..1c10055 100644
--- a/prometheus_client/exposition.py
+++ b/prometheus_client/exposition.py
@@ -179,9 +179,9 @@ def generate_latest(registry=REGISTRY):
             mtype = metric.type
             # Munging from OpenMetrics into Prometheus format.
             if mtype == 'counter':
-                mname = mname + '_total'
+                mname += '_total'
             elif mtype == 'info':
-                mname = mname + '_info'
+                mname += '_info'
                 mtype = 'gauge'
             elif mtype == 'stateset':
                 mtype = 'gauge'

elfring avatar Oct 30 '21 17:10 elfring