Skip to content

Commit 433fa27

Browse files
authored
Merge pull request #46165 from iarspider/iarspider-patches-20240930-1
[DB] Fix syntax in python scripts
2 parents 4c7bac9 + c74af2e commit 433fa27

File tree

6 files changed

+64
-63
lines changed

6 files changed

+64
-63
lines changed

CondCore/EcalPlugins/test/inspectPed.py

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#
22
# I should write a decent test of the python binding...
33
#
4-
import sys, DLFCN
4+
import sys, DLFCN, importlib
55
sys.setdlopenflags(DLFCN.RTLD_GLOBAL+DLFCN.RTLD_LAZY)
66

77
from pluginCondDBPyInterface import *
@@ -27,13 +27,13 @@
2727
for tag in tags.split() :
2828
try :
2929
log = db.lastLogEntry(tag)
30-
print log.getState()
30+
print(log.getState())
3131
iov = inspect.Iov(db,tag)
32-
print iov.list()
33-
# print iov.summaries()
34-
# print iov.trend("",[0,2,12])
32+
print(iov.list())
33+
# print(iov.summaries())
34+
# print(iov.trend("",[0,2,12]))
3535
except RuntimeError :
36-
print " no iov? in", tag
36+
print(" no iov? in", tag)
3737

3838

3939
iov=0
@@ -50,11 +50,11 @@
5050

5151

5252
iov = inspect.Iov(db,tag)
53-
print iov.trend(ans)
53+
print(iov.trend(ans))
5454
ans = {'how': 'all', 'quantity': 'mean_x3', 'which' : []}
55-
print iov.trend(an)
55+
print(iov.trend(ans))
5656
ans = {'how': 'singleChannel', 'quantity': 'mean_x6', 'which' : [0,200,1200]}
57-
print iov.trend(ans)
57+
print(iov.trend(ans))
5858

5959

6060

@@ -64,7 +64,7 @@
6464
token = log.payloadToken
6565

6666
p = inspect.PayLoad(db,token)
67-
print p
67+
print(p)
6868

6969
p=0
7070

@@ -83,21 +83,21 @@
8383

8484
o = iovInspector.PayLoad(db,log.payloadToken)
8585

86-
exec('import '+db.moduleName(tag)+' as Plug')
87-
iov = db.iov(tag)
88-
log = db.lastLogEntry(tag)
89-
print tag, iov.size(), log.execmessage, log.exectime, log.payloadIdx
90-
vi = VInt()
91-
vi.append(0)
92-
vi.append(2)
93-
vi.append(12)
94-
ex = Plug.Extractor("",vi)
95-
for elem in iov.elements :
96-
p = Plug.Object(elem)
97-
print elem.since(), elem.till(),p.summary()
98-
p.extract(ex)
99-
for v in ex.values() :
100-
print v
86+
Plug = importlib.import_module(db.moduleName(tag))
87+
iov = db.iov(tag)
88+
log = db.lastLogEntry(tag)
89+
print(tag, iov.size(), log.execmessage, log.exectime, log.payloadIdx )
90+
vi = VInt()
91+
vi.append(0)
92+
vi.append(2)
93+
vi.append(12)
94+
ex = Plug.Extractor("",vi)
95+
for elem in iov.elements :
96+
p = Plug.Object(elem)
97+
print(elem.since(), elem.till(),p.summary())
98+
p.extract(ex)
99+
for v in ex.values() :
100+
print(v)
101101

102102

103103
token = '[DB=00000000-0000-0000-0000-000000000000][CNT=EcalPedestalsRcd][CLID=75E7B995-8233-097B-FD4A-31AEC6A040C8][TECH=00000B01][OID=0000000C-00000114]'

CondCore/PopCon/test/inspect.py

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -24,28 +24,28 @@
2424
for tag in tags.split() :
2525
try :
2626
log = db.lastLogEntry(tag)
27-
print log.getState()
27+
print(log.getState())
2828
iov = inspect.Iov(db,tag)
29-
print iov.list()
30-
# print iov.summaries()
31-
# print iov.trend("",[0,2,12])
29+
print(iov.list())
30+
# print(iov.summaries())
31+
# print(iov.trend("",[0,2,12]))
3232
except RuntimeError :
33-
print " no iov? in", tag
33+
print(" no iov? in", tag)
3434

3535

3636
iov=0
3737

3838
tag='Example_tag2'
3939
what = inspect.extractorWhat(db,tag)
40-
print what
40+
print(what)
4141

4242
ans = {'which':[0,2,12],'quantity':[0]}
4343
iov = inspect.Iov(db,tag)
44-
print iov.trend(ans)
44+
print(iov.trend(ans))
4545
ans = {'which':[0,2,12],'quantity':[1]}
46-
print iov.trend(ans)
46+
print(iov.trend(ans))
4747
ans = {'which':[0,2,12],'quantity':[0,1]}
48-
print iov.trend(ans)
48+
print(iov.trend(ans))
4949

5050

5151

@@ -55,7 +55,7 @@
5555
token = log.payloadToken
5656

5757
p = inspect.PayLoad(db,token)
58-
print p
58+
print(p)
5959

6060
p=0
6161

@@ -74,21 +74,21 @@
7474

7575
o = iovInspector.PayLoad(db,log.payloadToken)
7676

77-
exec('import '+db.moduleName(tag)+' as Plug')
78-
iov = db.iov(tag)
79-
log = db.lastLogEntry(tag)
80-
print tag, iov.size(), log.execmessage, log.exectime, log.payloadIdx
81-
vi = VInt()
82-
vi.append(0)
83-
vi.append(2)
84-
vi.append(12)
85-
ex = Plug.Extractor("",vi)
86-
for elem in iov.elements :
87-
p = Plug.Object(elem)
88-
print elem.since(), elem.till(),p.summary()
89-
p.extract(ex)
90-
for v in ex.values() :
91-
print v
77+
exec('import '+db.moduleName(tag)+' as Plug')
78+
iov = db.iov(tag)
79+
log = db.lastLogEntry(tag)
80+
print(tag, iov.size(), log.execmessage, log.exectime, log.payloadIdx )
81+
vi = VInt()
82+
vi.append(0)
83+
vi.append(2)
84+
vi.append(12)
85+
ex = Plug.Extractor("",vi)
86+
for elem in iov.elements :
87+
p = Plug.Object(elem)
88+
print(elem.since(), elem.till(),p.summary())
89+
p.extract(ex)
90+
for v in ex.values() :
91+
print(v)
9292

9393

9494
token = '[DB=00000000-0000-0000-0000-000000000000][CNT=EcalPedestalsRcd][CLID=75E7B995-8233-097B-FD4A-31AEC6A040C8][TECH=00000B01][OID=0000000C-00000114]'

CondTools/Geometry/test/hgcalgeometrywriter.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@
2828
process.HGCalHEScParametersWriter = cms.EDAnalyzer("PHGCalParametersDBBuilder",
2929
Name = cms.untracked.string("HGCalHEScintillatorSensitive"),
3030
NameW = cms.untracked.string("HGCalWafer"),
31-
NameC = cms.untracked.string("HGCalCell")),
32-
NameT = cms.untracked.string("HGCal")
31+
NameC = cms.untracked.string("HGCalCell"),
32+
NameT = cms.untracked.string("HGCal")
33+
)
3334

3435
process.CondDB.timetype = cms.untracked.string('runnumber')
3536
process.CondDB.connect = cms.string('sqlite_file:myfile.db')

CondTools/Hcal/test/dumpHcalDcsMap_cfg.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@
4343
)
4444

4545

46-
process.es_pool = cms.ESSource("PoolDBESSource",
47-
process.CondDBSetup,
48-
timetype = cms.string('runnumber'),
49-
connect = cms.string('sqlite_file:testExample.db'),
50-
authenticationMethod = cms.untracked.uint32(0),
51-
toGet = cms.VPSet(
46+
#process.es_pool = cms.ESSource("PoolDBESSource",
47+
# process.CondDBSetup,
48+
# timetype = cms.string('runnumber'),
49+
# connect = cms.string('sqlite_file:testExample.db'),
50+
# authenticationMethod = cms.untracked.uint32(0),
51+
# toGet = cms.VPSet(
5252
# cms.PSet(
5353
# record = cms.string('HcalPedestalsRcd'),
5454
# tag = cms.string('hcal_pedestals_fC_v6_mc')

CondTools/RPC/test/writeRPCEMap2DB.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
mport FWCore.ParameterSet.Config as cms
1+
import FWCore.ParameterSet.Config as cms
22

33
process = cms.Process("Write2DB")
44
process.load("CondCore.DBCommon.CondDBCommon_cfi")

CondTools/SiPixel/test/SiPixelTemplateDBObjectReader_cfg.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,17 @@
3434
options.parseArguments()
3535

3636
MagFieldValue = 10.*options.MagField #code needs it in deciTesla
37-
print '\nMagField = %f deciTesla \n'%(MagFieldValue)
37+
print('\nMagField = %f deciTesla \n'%(MagFieldValue))
3838
version = options.Version
39-
print'\nVersion = %s \n'%(version)
39+
print('\nVersion = %s \n'%(version))
4040
magfieldstrsplit = str(options.MagField).split('.')
4141
MagFieldString = magfieldstrsplit[0]
4242
if len(magfieldstrsplit)>1 :
4343
MagFieldString+=magfieldstrsplit[1]
4444

4545
template_base = 'SiPixelTemplateDBObject_'+MagFieldString+'T_'+options.Year+'_v'+version
46-
print "Testing sqlite file: "+template_base+".db"
47-
print " tag: "+template_base
46+
print("Testing sqlite file: "+template_base+".db")
47+
print(" tag: "+template_base)
4848

4949

5050
from Configuration.StandardSequences.Eras import eras

0 commit comments

Comments
 (0)