results[x][y] = 0 for x in targets.keys(): for y in slpsXPath.rkeys: results[y][x] = 0 for y in targets[x]: xbgfFile = path+y+'.xbgf' xbgf = ET.parse(xbgfFile) results['LOC'][x] += slpsXPath.loc(xbgfFile) results['NOI'][x] += slpsXPath.nosi(xbgfFile,'ISSUE') results['NI~'][x] += slpsXPath.nosi(xbgfFile,'ISSUE REFACTOR') results['NI+'][x] += slpsXPath.nosi(xbgfFile,'EXTEND') results['NI!'][x] += slpsXPath.nosi(xbgfFile,'CORRECT') results['NI^'][x] += slpsXPath.nosi(xbgfFile,'PERMISSIVENESS') results['COR'][x] += slpsXPath.nosi(xbgfFile,'EXTRACTERROR') results['SGO'][x] += slpsXPath.countSemanticPreserving(xbgf,xbgfFile) results['SID'][x] += slpsXPath.countSemanticIncDec(xbgf,xbgfFile) results['SRE'][x] += slpsXPath.countSemanticRevising(xbgf,xbgfFile) results['NOX'][x] += slpsXPath.notr(xbgf) results['EKB'][x] += slpsXPath.nosi(xbgfFile,'KNOWNBUG') results['EPX'][x] += slpsXPath.nosi(xbgfFile,'POSTEXTR') results['EIC'][x] += slpsXPath.nosi(xbgfFile,'INITCORR') results['EAR'][x] += slpsXPath.nosi(xbgfFile,'KNOWNBUG')+slpsXPath.nosi(xbgfFile,'POSTEXTR')+slpsXPath.nosi(xbgfFile,'INITCORR') results['FEX'][x] += slpsXPath.nosi(xbgfFile,'EXTENSION') results['FRE'][x] += slpsXPath.nosi(xbgfFile,'RELAXATION') results['FCO'][x] += slpsXPath.nosi(xbgfFile,'CORRECTION') results['FIN'][x] += slpsXPath.nosi(xbgfFile,'EXTENSION')+slpsXPath.nosi(xbgfFile,'RELAXATION')+slpsXPath.nosi(xbgfFile,'CORRECTION') for z in names: results[z][x] += len(xbgf.findall('/'+slpsns.xbgf_(z))) for x in names[:]: used = False for y in targets.keys():
names = [] targets = {} results = {} if __name__ == "__main__": if len(sys.argv) != 2: print 'This tool generates an overview of an XBGF script.' print 'Usage:' print ' checkxbgf <file>' sys.exit(1) xbgfFile = sys.argv[1] xbgf = ET.parse(xbgfFile) print "%30s" % xbgfFile.split('.')[0] + ':', cx = slpsXPath.countSemanticPreserving(xbgf,xbgfFile), \ slpsXPath.countSemanticIncDec(xbgf,xbgfFile), \ slpsXPath.countSemanticRevising(xbgf,xbgfFile) early = slpsXPath.nosi(xbgfFile, 'KNOWNBUG'), slpsXPath.nosi( xbgfFile, 'POSTEXTR'), slpsXPath.nosi(xbgfFile, 'INITCORR') final = slpsXPath.nosi(xbgfFile, 'EXTENSION'), slpsXPath.nosi( xbgfFile, 'RELAXATION'), slpsXPath.nosi(xbgfFile, 'CORRECTION') realSum = slpsXPath.notr(xbgf) print "%3i +%3i +%3i =%4i" % (cx[0], cx[1], cx[2], realSum), if sum(early): print '[', if early[0]: print 'K' + ` early[0] `, if early[1]: print 'P' + ` early[1] `, if early[2]: print 'I' + ` early[2] `,
names = [] targets = {} results = {} if __name__ == "__main__": if len(sys.argv) != 2: print 'This tool generates an overview of an XBGF script.' print 'Usage:' print ' checkxbgf <file>' sys.exit(1) xbgfFile = sys.argv[1] xbgf = ET.parse(xbgfFile) print "%30s" % xbgfFile.split('.')[0]+':', cx = slpsXPath.countSemanticPreserving(xbgf,xbgfFile), \ slpsXPath.countSemanticIncDec(xbgf,xbgfFile), \ slpsXPath.countSemanticRevising(xbgf,xbgfFile) early = slpsXPath.nosi(xbgfFile,'KNOWNBUG'), slpsXPath.nosi(xbgfFile,'POSTEXTR'), slpsXPath.nosi(xbgfFile,'INITCORR') final = slpsXPath.nosi(xbgfFile,'EXTENSION'), slpsXPath.nosi(xbgfFile,'RELAXATION'), slpsXPath.nosi(xbgfFile,'CORRECTION') realSum = slpsXPath.notr(xbgf) print "%3i +%3i +%3i =%4i" % (cx[0],cx[1],cx[2],realSum), if sum(early): print '[', if early[0]: print 'K'+`early[0]`, if early[1]: print 'P'+`early[1]`, if early[2]: print 'I'+`early[2]`, print ']', if sum(final):