6 print(
"file names must be passed as arguments")
8 if args[1] ==
'-h' or args[1] ==
'--help':
10 """python edm_modernize_messagelogger.py [-h/--help] filename [...] 12 Converts explicit constructions of cms.Service("MessageLogger") from old MessageLogger 13 configration syntax to new the new syntax. 14 The script expects a list of files to be modified in place. 16 NOTE: The script is known to miss some corner-cases in the conversion so always check 17 the results of the transformation. 25 ml = process.MessageLogger.clone()
26 if hasattr(process.MessageLogger,
"statistics"):
27 stat = process.MessageLogger.statistics
29 dest = getattr(ml, s.value())
30 dest.enableStatistics = cms.untracked.bool(
True)
32 dest = process.MessageLogger.destinations
33 files = cms.untracked.PSet()
34 if 'cerr' not in dest:
35 ml.cerr = cms.untracked.PSet(enable = cms.untracked.bool(
False))
41 setattr(files, d, getattr(ml,d.value()))
44 if hasattr(ml,
'categories'):
49 newF = open(arg+
"new",
"w")
53 for l
in f.readlines():
55 if 'process.MessageLogger' == l[0:21]:
57 parenthesis = l.count(
'(')
58 parenthesis -= l.count(
')')
64 parenthesis += l.count(
'(')
65 parenthesis -= l.count(
')')
68 newF.write(
'process.MessageLogger = '+ml.dumpPython())
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)