Commit a3554e2e authored by scott snyder's avatar scott snyder
Browse files

TrigConfigSvc: Basic python3 fixes.

print function.
functions removed from string module.
parent 23c9353a
...@@ -3,6 +3,9 @@ ...@@ -3,6 +3,9 @@
from __future__ import print_function from __future__ import print_function
# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration # Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
from __future__ import print_function
from AthenaCommon.Logging import logging from AthenaCommon.Logging import logging
import time import time
...@@ -89,10 +92,10 @@ class FrontierCursor2: ...@@ -89,10 +92,10 @@ class FrontierCursor2:
#session.printHeader() #session.printHeader()
#nfield = session.getNumberOfFields() #nfield = session.getNumberOfFields()
#print "\nNumber of fields:", nfield, "\n" #print ("\nNumber of fields:", nfield, "\n")
#nrec = session.getNumberOfRecords() #nrec = session.getNumberOfRecords()
#print "\nResult contains", nrec, "objects.\n" #print ("\nResult contains", nrec, "objects.\n")
#session.printRecords2() #session.printRecords2()
queryEnd = time.localtime() queryEnd = time.localtime()
...@@ -142,8 +145,9 @@ Refresh cache: %s""" % (self.url, self.refreshFlag) ...@@ -142,8 +145,9 @@ Refresh cache: %s""" % (self.url, self.refreshFlag)
import urllib2 import urllib2
try: try:
urllib2.urlopen(url) urllib2.urlopen(url)
except urllib2.URLError as e: except urllib2.URLError:
print (e) import traceback
traceback.print_exc()
def execute(self, query, bindvars={}): def execute(self, query, bindvars={}):
if len(bindvars)>0: if len(bindvars)>0:
...@@ -191,7 +195,7 @@ Refresh cache: %s""" % (self.url, self.refreshFlag) ...@@ -191,7 +195,7 @@ Refresh cache: %s""" % (self.url, self.refreshFlag)
log = logging.getLogger( "TrigConfFrontier.py" ) log = logging.getLogger( "TrigConfFrontier.py" )
from xml.dom.minidom import parseString from xml.dom.minidom import parseString
import base64, zlib, curses.ascii import base64, zlib, curses.ascii
#print "Query result:\n", self.result #print ("Query result:\n", self.result)
dom = parseString(self.result) dom = parseString(self.result)
dataList = dom.getElementsByTagName("data") dataList = dom.getElementsByTagName("data")
keepalives = 0 keepalives = 0
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
## @author Joerg Stelzer <stelzer@cern.ch> ## @author Joerg Stelzer <stelzer@cern.ch>
from __future__ import print_function from __future__ import print_function
from past.builtins import cmp
import sys import sys
import ROOT import ROOT
...@@ -390,7 +389,7 @@ class TriggerConfigARA(object): ...@@ -390,7 +389,7 @@ class TriggerConfigARA(object):
foundAnyIOV = True foundAnyIOV = True
if not foundAnyIOV: return None if not foundAnyIOV: return None
# sort the payload by IOV and remove the overlap # sort the payload by IOV and remove the overlap
payloadList.sort(lambda x,y: cmp(x[0].start(),y[0].start())) payloadList.sort(key = lambda a: a[0].start())
for i in range(len(payloadList)-1): for i in range(len(payloadList)-1):
payloadList[i][0] = ROOT.IOVRange(payloadList[i][0].start(),payloadList[i+1][0].start()) payloadList[i][0] = ROOT.IOVRange(payloadList[i][0].start(),payloadList[i+1][0].start())
# get the content # get the content
...@@ -420,7 +419,7 @@ class TriggerConfigARA(object): ...@@ -420,7 +419,7 @@ class TriggerConfigARA(object):
# sort the payload by IOV and remove the overlap # sort the payload by IOV and remove the overlap
for ch in range(256): for ch in range(256):
x = payloadList[ch] x = payloadList[ch]
x.sort(lambda x,y: cmp(x[0].start(),y[0].start())) x.sort(key = lambda a: a[0].start())
for i in range(len(x)-1): for i in range(len(x)-1):
x[i][0] = ROOT.IOVRange(x[i][0].start(),x[i+1][0].start()) x[i][0] = ROOT.IOVRange(x[i][0].start(),x[i+1][0].start())
# read the payload # read the payload
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment