diff options
Diffstat (limited to 'lib/loader.py')
-rw-r--r-- | lib/loader.py | 23 |
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)) |