424 def _compareComponent(compRef, compChk, prefix, args, component, propname, color):
426 if isinstance(compRef, dict):
427 allProps =
list(
set(compRef.keys()) |
set(compChk.keys()))
430 for prop
in allProps:
431 if prop
not in compRef.keys():
433 print(f
"{prefix}{color.property}{prop} = {color.second}{compChk[prop]} {color.reset} only in 2nd file {color.reset}")
436 print(f
"{prefix}known difference in: {prop}")
439 if prop
not in compChk.keys():
441 print(f
"{prefix}{color.property}{prop} = {color.first}{compRef[prop]} {color.reset} only in 1st file {color.reset}")
444 print(f
"{prefix}known difference in: {prop}")
447 refVal = compRef[prop]
448 chkVal = compChk[prop]
451 refVal = ast.literal_eval(
str(refVal))
if refVal
else ""
452 chkVal = ast.literal_eval(
str(chkVal))
if chkVal
else ""
463 if not args.printIdenticalPerParameter:
466 print(f
"{prefix}known difference in: {prop}")
467 if not args.printIdenticalPerParameter:
470 diffmarker = f
" {color.difference}<<{color.reset}"
472 if not (component ==
"IOVDbSvc" and prop ==
"Folders"):
473 print(f
"{prefix}{color.property}{prop} = {color.first} {refVal} {color.reset} vs {color.second} {chkVal} {color.reset} {diffmarker}")
475 if refVal
and ( isinstance(refVal, list)
or isinstance(refVal, dict) ):
476 if component ==
"IOVDbSvc" and prop ==
"Folders":
480 refVal, chkVal,
"\t" + prefix +
">> ", args, component, prop, color
483 elif isinstance(compRef, (list, tuple, set))
and len(compRef) > 1:
485 if isinstance(compRef[0], list):
488 if len(compChk) > 0
and isinstance(compChk[0], list):
492 if compRef == compChk:
493 return countDifferent
499 print(f
"{prefix} {color.reset}only in 1st file : {color.first} {diffRef} {color.reset}")
502 print(f
"{prefix} {color.reset}only in 2nd file : {color.second} {diffChk} {color.reset}")
505 if len(compRef) == len(compChk):
507 if any(re.match(f
"^{regex}$",f
"{component}.{propname}")
for regex
in args.ignoreOrder):
508 print(f
"{prefix} : {color.knowndifference} ^^ Different order ignored ^^ {color.reset}")
510 print(f
"{prefix} : {color.difference} ^^ Different order ^^ {color.reset}")
513 for i, (refVal, chkVal)
in enumerate(zip(compRef, compChk)):
515 print(f
"{prefix} : {color.first} {refVal} {color.reset} vs {color.second} {chkVal} {color.reset} {color.difference}<< at index {i} {color.reset}")
517 refVal, chkVal,
"\t" + prefix +
">> ", args,
"",
"", color
519 return countDifferent