From d1db093f7386799533b8924cd4085ca3475b632a Mon Sep 17 00:00:00 2001
From: stedif <stefano.difrischia@inaf.it>
Date: Thu, 28 Jul 2022 15:32:37 +0200
Subject: [PATCH] L2SS-777: improve device_list function

---
 .../code/tango-prometheus-client.py                    | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/docker-compose/tango-prometheus-exporter/code/tango-prometheus-client.py b/docker-compose/tango-prometheus-exporter/code/tango-prometheus-client.py
index cb3953412..f4a3ac802 100644
--- a/docker-compose/tango-prometheus-exporter/code/tango-prometheus-client.py
+++ b/docker-compose/tango-prometheus-exporter/code/tango-prometheus-client.py
@@ -43,13 +43,13 @@ class ArchiverPolicy(object):
         device_list = []
         db = Database()
         server_list = db.get_server_list()  # e.g. SDP/STAT, RECV/STAT
-        for i in range(0, len(server_list)):
+        for server in server_list:
             # https://pytango.readthedocs.io/en/stable/database.html#tango.Database.get_device_class_list
-            class_list = db.get_device_class_list(server_list[i])
-            for j in range(0, len(class_list), 2):
-                if "dserver" in class_list[j]:
+            class_list = db.get_device_class_list(server)
+            for cls in class_list[::2]:
+                if "dserver" in cls:
                     continue
-                device_list.append(class_list[j].lower())
+                device_list.append(cls.lower())
         return device_list
     
     def multimember_device_list(config_devices: list) -> list:
-- 
GitLab