Changeset 228
- Timestamp:
- 01/10/14 13:21:59 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
CCCC/branches/branch-sp/ceda_cc/c4.py
r212 r228 475 475 self.cc = checker(pcfg, c4i.project, ncReader,abortMessageCount=abortMessageCount) 476 476 rec = recorder( c4i.project, c4i.recordFile, dummy=isDummy ) 477 478 # This list will record the drs dictionaries of all checked files for export to JSON 479 drs_list = [] 480 477 481 if monitorFileHandles: 478 482 self.monitor = utils.sysMonitor() … … 549 553 if self.cc.errorCount == 0: 550 554 rec.add( f, self.cc.drs ) 555 drs_list.append({'path': f, 'drs': self.cc.drs}) 551 556 else: 552 557 rec.addErr( f, 'ERRORS FOUND | errorCount = %s' % self.cc.errorCount ) … … 594 599 rec.checktids() 595 600 rec.dumpAll() 601 602 #!TODO: the recorder class could export JSON if it recorded the full drs dictionaries. 603 # This lightweight solution re-uses the filename from the rec class and dumps 604 # JSON in a separate function. 605 json_file = os.path.splitext(rec.file)[0] + '.json' 606 dump_drs_list(drs_list, json_file) 607 596 608 if printInfo: 597 609 print 'Error count %s' % ecount … … 601 613 602 614 603 615 def dump_drs_list(drs_list, filename): 616 import json 617 fh = open(filename, 'w') 618 json.dump(drs_list, fh) 619 fh.close() 604 620 605 621
Note: See TracChangeset
for help on using the changeset viewer.