423 def _compareComponent(compRef, compChk, prefix, args, component, propname, color):
425 if isinstance(compRef, dict):
426 allProps =
list(
set(compRef.keys()) |
set(compChk.keys()))
429 for prop
in allProps:
430 if prop
not in compRef.keys():
432 print(f
"{prefix}{color.property}{prop} = {color.second}{compChk[prop]} {color.reset} only in 2nd file {color.reset}")
435 print(f
"{prefix}known difference in: {prop}")
438 if prop
not in compChk.keys():
440 print(f
"{prefix}{color.property}{prop} = {color.first}{compRef[prop]} {color.reset} only in 1st file {color.reset}")
443 print(f
"{prefix}known difference in: {prop}")
446 refVal = compRef[prop]
447 chkVal = compChk[prop]
450 refVal = ast.literal_eval(
str(refVal))
if refVal
else ""
451 chkVal = ast.literal_eval(
str(chkVal))
if chkVal
else ""
462 if not args.printIdenticalPerParameter:
465 print(f
"{prefix}known difference in: {prop}")
466 if not args.printIdenticalPerParameter:
469 diffmarker = f
" {color.difference}<<{color.reset}"
471 if not (component ==
"IOVDbSvc" and prop ==
"Folders"):
472 print(f
"{prefix}{color.property}{prop} = {color.first} {refVal} {color.reset} vs {color.second} {chkVal} {color.reset} {diffmarker}")
474 if refVal
and ( isinstance(refVal, list)
or isinstance(refVal, dict) ):
475 if component ==
"IOVDbSvc" and prop ==
"Folders":
479 refVal, chkVal,
"\t" + prefix +
">> ", args, component, prop, color
482 elif isinstance(compRef, (list, tuple, set))
and len(compRef) > 1:
484 if isinstance(compRef[0], list):
487 if len(compChk) > 0
and isinstance(compChk[0], list):
491 if compRef == compChk:
492 return countDifferent
498 print(f
"{prefix} {color.reset}only in 1st file : {color.first} {diffRef} {color.reset}")
501 print(f
"{prefix} {color.reset}only in 2nd file : {color.second} {diffChk} {color.reset}")
504 if len(compRef) == len(compChk):
506 if any(re.match(f
"^{regex}$",f
"{component}.{propname}")
for regex
in args.ignoreOrder):
507 print(f
"{prefix} : {color.knowndifference} ^^ Different order ignored ^^ {color.reset}")
509 print(f
"{prefix} : {color.difference} ^^ Different order ^^ {color.reset}")
512 for i, (refVal, chkVal)
in enumerate(zip(compRef, compChk)):
514 print(f
"{prefix} : {color.first} {refVal} {color.reset} vs {color.second} {chkVal} {color.reset} {color.difference}<< at index {i} {color.reset}")
516 refVal, chkVal,
"\t" + prefix +
">> ", args,
"",
"", color
518 return countDifferent