From 41cf96f450fc8b87aad9701e2de510c3eb20956d Mon Sep 17 00:00:00 2001 From: Enrico Faulhaber Date: Tue, 16 Jul 2019 14:12:09 +0200 Subject: [PATCH] configurables: switch from list to dict Change-Id: I2e13703ca7ee928aec15b99e81120d003e88c839 Reviewed-on: https://forge.frm2.tum.de/review/20917 Tested-by: JenkinsCodeReview Reviewed-by: Enrico Faulhaber --- secop/metaclass.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/secop/metaclass.py b/secop/metaclass.py index dcfcb5f..736f0fe 100644 --- a/secop/metaclass.py +++ b/secop/metaclass.py @@ -192,13 +192,14 @@ class ModuleMeta(PropertyMeta): def configurables(cls): # note: this ends up as an property of the Module class (not on the instance)! - # list of tuples (cfg-file key, Property/Parameter) - res = [] + # dict of properties with Property and Parameter with dict of properties + res = {} # collect info about properties for pn, pv in cls.properties.items(): - res.append((u'%s' % pn, pv,)) + res[pn] = pv # collect info about parameters and their properties for param, pobj in cls.accessibles.items(): + res[param] = {} for pn, pv in pobj.__class__.properties.items(): - res.append((u'%s.%s' % (param,pn), pv)) + res[param][pn] = pv return res