CMS 3D CMS Logo

diff_provenance.py
Go to the documentation of this file.
1 from __future__ import print_function
2 class difference :
3 
4  def __init__(self,v):
5  self.verbose = v
6 
7  def list_diff(self,aList1, aList2, string1, string2):
8  "Searches for differences between two modules of the same kind"
9  for i in range(2,len(aList1)):
10  for j in range(2,len(aList2)):
11  if (i==j) and (aList1[i]!=aList2[j]):
12  if aList1[i][:(aList1[i].index('=')+1)] == aList2[j][:(aList2[j].index('=')+1)]:
13  if self.verbose==str(2) or self.verbose==str(1):
14  print(aList1[i][2:aList1[i].index('=')+1] + aList1[i][aList1[i].index('=')+1:]+' ['+ string1+']')
15  print(len(aList1[i][2:aList1[i].index('=')+1])*' '+aList2[j][aList2[j].index('=')+1:]+' ['+string2+']')
16  print('')
17 
18 
19  def module_diff(self,module1,module2, string1, string2):
20  "Searches for modules which are in both the files but whose parameters are setted at different values"
21  modulesfile1=[]
22  modulesfile2=[]
23  print('\nList of modules present in both the files with different parameter values\n')
24  for i in module1.keys():
25  for j in module2.keys():
26  if (i==j) and (module1[i]!=module2[j]):
27  print('Module: '+'"'+i+'"')
28  d=difference(self.verbose)
29  d.module=i
30  d.firstvalue=module1[i]
31  d.secondvalue=module2[j]
32  self.list_diff(d.firstvalue,d.secondvalue, string1, string2)
33  else: pass
34 
35  self.onefilemodules(module1,module2,'first')
36  self.onefilemodules(module2,module1,'second')
37 
38 
39  def onefilemodules(self,module1,module2,string):
40  "Searches for modules present only in one of the two files"
41  onlyonefile=False
42  for i in module1.keys():
43  if i not in module2:
44  if not onlyonefile:
45  print('\nModule present only in the '+string+ ' file:'+'\n')
46  onlyonefile = True
47  print('Module: '+'"'+i+'"')
48  if self.verbose==str(2):
49  for k in range(1,len(module1[i])):
50  print(module1[i][k])
51 
52 
def list_diff(self, aList1, aList2, string1, string2)
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:65
def onefilemodules(self, module1, module2, string)
def module_diff(self, module1, module2, string1, string2)
#define str(s)