summaryrefslogtreecommitdiff
path: root/lib/loader.py
diff options
context:
space:
mode:
authorDaniel Friesel <daniel.friesel@uos.de>2020-09-16 09:04:26 +0200
committerDaniel Friesel <daniel.friesel@uos.de>2020-09-16 09:04:26 +0200
commitf0a48e3115938809f0ceec133f3c850a707e3f58 (patch)
treeb2c92855ef352957d56c0d17923cd3a8cb81f3f0 /lib/loader.py
parentd3a4e84f513beeeeda71cf451ed7b2b71808ba80 (diff)
kconfig model: json import
Diffstat (limited to 'lib/loader.py')
-rw-r--r--lib/loader.py23
1 files changed, 15 insertions, 8 deletions
diff --git a/lib/loader.py b/lib/loader.py
index 3f0662e..14b7853 100644
--- a/lib/loader.py
+++ b/lib/loader.py
@@ -13,6 +13,7 @@ import hashlib
import kconfiglib
from multiprocessing import Pool
from .utils import running_mean, soft_cast_int
+from frozendict import frozendict
logger = logging.getLogger(__name__)
@@ -1953,8 +1954,9 @@ class KConfigAttributes:
experiments.append((config_path, attr_path))
kconf = kconfiglib.Kconfig(kconfig_path)
+ self.kconf = kconf
- self.symbols = sorted(
+ self.symbol_names = sorted(
map(
lambda sym: sym.name,
filter(
@@ -1964,17 +1966,22 @@ class KConfigAttributes:
)
)
- self.data = list()
+ self.choice_names = sorted(map(lambda choice: choice.name, kconf.choices))
+
+ self.symbol = kconf.syms
+ self.choice = dict()
+ for choice in kconf.choices:
+ self.choice[choice.name] = choice
- config_vectors = set()
+ self.data = list()
for config_path, attr_path in experiments:
kconf.load_config(config_path)
with open(attr_path, "r") as f:
attr = json.load(f)
- config_vector = tuple(
- map(lambda sym: kconf.syms[sym].tri_value == 2, self.symbols)
- )
- config_vectors.add(config_vector)
- self.data.append((config_vector, attr))
+ config = dict.fromkeys(self.symbol_names, False)
+ for sym in self.symbol_names:
+ if kconf.syms[sym].tri_value == 2:
+ config[sym] = True
+ self.data.append((frozendict(config), attr))