CMS 3D CMS Logo

Public Member Functions | Public Attributes | Private Attributes

python::diffProv::difference Class Reference

List of all members.

Public Member Functions

def __init__
def list_diff
def module_diff
def onefilemodules

Public Attributes

 verbose

Private Attributes

 _diffprocess
 _sameprocess

Detailed Description

Definition at line 2 of file diffProv.py.


Constructor & Destructor Documentation

def python::diffProv::difference::__init__ (   self,
  v 
)

Definition at line 4 of file diffProv.py.

00005                         :
00006         self.verbose = v
00007         self._diffprocess=[]
        self._sameprocess=()

Member Function Documentation

def python::diffProv::difference::list_diff (   self,
  aList1,
  aList2,
  string1,
  string2 
)

Definition at line 8 of file diffProv.py.

00009                                                         :
00010         "Searches for differences between two modules of the same kind"
00011         differences=[]
00012         for i in range(2,len(aList1)):
00013             for j in range(2,len(aList2)):
00014                 if (i==j) and (aList1[i]!=aList2[j]):
00015                     if aList1[i][:(aList1[i].index('=')+1)] == aList2[j][:(aList2[j].index('=')+1)]:
00016                         if self.verbose==str(2) or self.verbose==str(1):
00017                             str1 = aList1[i][2:aList1[i].index('=')+1] + aList1[i][aList1[i].index('=')+1:]+'  ['+ string1+']'
00018                             str2 = len(aList1[i][2:aList1[i].index('=')+1])*' '+aList2[j][aList2[j].index('=')+1:]+'  ['+string2+']'
00019                             print str1,'\n',str2,'\n'
00020                             differences.append(str1)
00021                             differences.append(str2)
00022                    
00023         return differences 
                                                    
def python::diffProv::difference::module_diff (   self,
  module1,
  module2,
  string1,
  string2 
)

Definition at line 24 of file diffProv.py.

00025                                                            :
00026         "Searches for modules which are in both the files but whose parameters are setted at different values"
00027         print '\nList of modules present in both the files with different parameter values\n'
00028         for i in module1.keys():
00029             for j in module2.keys():
00030                 if (i==j) and (i=='Processing'):
00031                     list= module1[i]
00032                     for k in range(len(list)):
00033                         process1=module1[i][k].split()
00034                         process2=module2[i][k].split()
00035                         if process1[0]!= process2[0]:
00036                             key1=process1[0]
00037                             key2=process2[0]
00038                             self._diffprocess.append( (key1,key2) )
00039                             
00040                     if len(self._diffprocess)>1:
00041                         print 'Differences in the processing history'
00042                         for l,m in self._diffprocess:         
00043                             print l+'  ['+string1+']'
00044                             print m+'  ['+string2+']'
00045                             print ''
00046                     if len(self._diffprocess)==1:
00047                         self._sameprocess=self._diffprocess[0]
00048                                                              
00049                 elif ( (i==j)or (i,j)==self._sameprocess ) and (i!='Processing'):
00050                     for name1,value1 in module1[i]:
00051                         for name2,value2 in module2[j]:
00052                             if  (name1==name2) and (value1[1:]!=value2[1:]):
00053                                 print 'Process: '+'"'+i+'"'+'\n'+'Module: '+'"'+name1+'"'+'\n'
00054                                 d=difference(self.verbose) 
00055                                 d.firstvalue=value1
00056                                 d.secondvalue=value2
00057                                 self.list_diff(d.firstvalue,d.secondvalue, string1, string2)
00058                     
00059         self.onefilemodules(module1,module2,'first')
00060         self.onefilemodules(module2,module1,'second')
00061     

def python::diffProv::difference::onefilemodules (   self,
  module1,
  module2,
  string 
)

Definition at line 62 of file diffProv.py.

00063                                                    :
00064         "Searches for modules present only in one of the two files"
00065         print '\nModules run only on the '+string+ ' edmfile:'+'\n'
00066         for i in module1.keys():
00067             labelList=[]
00068             if (i not in module2.keys())and (i not in self._sameprocess):
00069                 print '\n Process '+i+' not run on edmfile '+string +'\n'
00070             elif i!='Processing':
00071                 k=i
00072                 if i in self._sameprocess:
00073                     if i==self._sameprocess[0]:
00074                         k= self._sameprocess[1]
00075                     elif i==self._sameprocess[1]:
00076                         k= self._sameprocess[0]
00077                 labelList2=[module[0] for module in module2[k]]
00078                 labelList1=[module[0] for module in module1[i]]
00079                 for name, value in module1[i] :
00080                     if (name not in labelList2):
00081                         print 'Process: '+'"'+i+'"'+'\n'+'Module: '+'"'+name+'"'
00082                         if  self.verbose==str(2):
00083                             for k in value[1:]:
00084                                 print k
00085                                 
00086 
00087 

Member Data Documentation

Definition at line 4 of file diffProv.py.

Definition at line 4 of file diffProv.py.

Definition at line 4 of file diffProv.py.