Skip to content
Snippets Groups Projects
Commit 4cc0acd7 authored by Michal Leszczynski's avatar Michal Leszczynski
Browse files

Move ignoreIrrelevant option application to file loading function

parent fa7ed7ea
No related branches found
No related tags found
No related merge requests found
......@@ -78,6 +78,19 @@ def parse_args():
def main(args):
if args.ignoreIrrelevant:
args.ignoreList = [
"StoreGateSvc",
"OutputLevel",
"MuonEDMHelperSvc",
"ExtraInputs",
"ExtraOutputs",
"DetStore",
"EvtStore",
"NeededResources",
]
print(f"Components to ignore: {args.ignoreList}")
if args.printComps:
for fileName in args.file:
conf = _loadSingleFile(fileName, args)
......@@ -124,18 +137,6 @@ def main(args):
if isinstance(chk, dict):
flattenedChk.update(chk)
if args.ignoreIrrelevant:
args.ignoreList = [
"StoreGateSvc",
"OutputLevel",
"MuonEDMHelperSvc",
"ExtraInputs",
"ExtraOutputs",
"DetStore",
"EvtStore",
"NeededResources",
]
print(f"Components to ignore: {args.ignoreList}")
_compareConfig(flattenedRef, flattenedChk, args)
......@@ -214,6 +215,15 @@ def _loadSingleFile(fname, args):
if isinstance(dic, dict)
]
if args.ignoreIrrelevant:
def remove_irrelevant(val_dict):
return {key:val for key, val in val_dict.items() if key not in args.ignoreList}
conf = [
{key: remove_irrelevant(value) for (key, value) in dic.items()}
for dic in conf
if isinstance(dic, dict)
]
return conf
......@@ -296,9 +306,6 @@ def _compareComponent(compRef, compChk, prefix, args, component):
allProps.sort()
for prop in allProps:
if args.ignoreIrrelevant and prop in args.ignoreList:
continue
if prop not in compRef.keys():
print(
"%s%s = %s: \033[94m exists only in 2nd file \033[0m \033[91m<< !!!\033[0m"
......@@ -324,9 +331,6 @@ def _compareComponent(compRef, compChk, prefix, args, component):
except ValueError:
pass # literal_eval exception when parsing particular strings
if args.ignoreIrrelevant and chkVal in args.ignoreList:
continue
refVal, chkVal = _parseNumericalValues(refVal, chkVal)
if str(chkVal) == str(refVal):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment