File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import importlib
12from itertools import chain
23from typing import Dict , Any
34from pathlib import Path
45import json
6+ from experimaestro .core .objects .config_utils import getqualattr
57from termcolor import colored
68
79
@@ -42,6 +44,11 @@ def build_value(data, store: Store):
4244 elif t == "path.serialized" :
4345 # Again, do not return anything (won't change the identifier)
4446 return None
47+ elif t == "enum" :
48+ module = importlib .import_module (data ["module" ])
49+ enumClass = getqualattr (module , data ["enum" ])
50+ return enumClass [data ["value" ]]
51+
4552 elif t is None :
4653 return {key : build_value (value , store ) for key , value in data .items ()}
4754 assert False , f"Data type { t } not handled"
@@ -71,7 +78,7 @@ def load(path: Path):
7178
7279
7380def print_diff (path : str , conf1 : Any , conf2 : Any ):
74- if type (conf1 ) != type (conf2 ):
81+ if type (conf1 ) is not type (conf2 ):
7582 print (f"[{ colored (path , 'red' )} ] { conf1 } and { conf2 } of different types" )
7683
7784 if isinstance (conf1 , ObjectProxy ) and isinstance (conf2 , ObjectProxy ):
You can’t perform that action at this time.
0 commit comments