Skip to content

Commit

Permalink
Merge pull request #12204 from ericvaandering/fix_py27exceptions2
Browse files Browse the repository at this point in the history
Do modern exceptions after conflicts resolved
  • Loading branch information
davidlange6 committed Nov 5, 2015
2 parents 22c342d + 3975ea7 commit fb81efe
Show file tree
Hide file tree
Showing 245 changed files with 2,276 additions and 2,296 deletions.
Expand Up @@ -69,7 +69,7 @@ def DBSquery(dataset,site,run):
print lineno()
try:
files = api.listFiles(path=dataset,tier_list =site,runNumber=run)
except DbsApiException, ex:
except DbsApiException as ex:
print "Caught API Exception %s: %s " % (ex.getClassName(), ex.getErrorMessage() )
files = ""
if ex.getErrorCode() not in (None, ""):
Expand Down
2 changes: 1 addition & 1 deletion Alignment/MuonAlignment/python/geometryDiff.py
Expand Up @@ -7,7 +7,7 @@

try:
opts, args = getopt.getopt(sys.argv[1:], "he:", ["help", "epsilon="])
except getopt.GetoptError, msg:
except getopt.GetoptError as msg:
print >>sys.stderr, usage
sys.exit(2)

Expand Down
10 changes: 5 additions & 5 deletions Alignment/MuonAlignment/python/geometryXMLparser.py
Expand Up @@ -110,17 +110,17 @@ def __init__(self, stream=None):
# what to do when you get to a <startelement>
def startElement(self, tag, attrib):
attrib = dict(attrib.items())
if "rawId" in attrib: raise Exception, "Please use \"rawIds = false\""
if "aa" in attrib: raise Exception, "Please use \"survey = false\""
if "rawId" in attrib: raise Exception("Please use \"rawIds = false\"")
if "aa" in attrib: raise Exception("Please use \"survey = false\"")

if tag == "MuonAlignment": pass

elif tag == "collection": raise NotImplementedError, "<collection /> and <collection> blocks aren't implemented yet"
elif tag == "collection": raise NotImplementedError("<collection /> and <collection> blocks aren't implemented yet")

elif tag == "operation":
self._operation = Operation()

elif self._operation is None: raise Exception, "All chambers and positions must be enclosed in <operation> blocks"
elif self._operation is None: raise Exception("All chambers and positions must be enclosed in <operation> blocks")

elif tag == "setposition":
self._operation.setposition["relativeto"] = str(attrib["relativeto"])
Expand Down Expand Up @@ -156,7 +156,7 @@ def startElement(self, tag, attrib):
# what to do when you get to an </endelement>
def endElement(self, tag):
if tag == "operation":
if self._operation is None: raise Exception, "Unbalanced <operation></operation>"
if self._operation is None: raise Exception("Unbalanced <operation></operation>")
for c in self._operation.chambers:
c.__dict__.update(self._operation.setposition)
c.__dict__.update(self._operation.setape)
Expand Down
4 changes: 2 additions & 2 deletions Alignment/MuonAlignment/python/geometryXMLtoCSV.py
Expand Up @@ -36,8 +36,8 @@ class ContentHandler(handler.ContentHandler):
# what to do when you get to a <startelement>
def startElement(self, tag, attrib):
attrib = dict(attrib.items())
if "rawId" in attrib: raise Exception, "Please use \"rawIds = false\""
if "aa" in attrib: raise Exception, "Please use \"survey = false\""
if "rawId" in attrib: raise Exception("Please use \"rawIds = false\"")
if "aa" in attrib: raise Exception("Please use \"survey = false\"")

# <DT...>: print wheel/station/sector/superlayer/layer
if tag[0:2] == "DT":
Expand Down
10 changes: 5 additions & 5 deletions Alignment/MuonAlignment/python/makeMuonMisalignmentScenario.py
Expand Up @@ -45,13 +45,13 @@

if not options.force:
if os.path.exists(outputName + ".xml"):
raise Exception, (outputName + ".xml exists!")
raise Exception(outputName + ".xml exists!")
if os.path.exists(outputName + "_convert_cfg.py"):
raise Exception, (outputName + "_convert_cfg.py exists!")
raise Exception(outputName + "_convert_cfg.py exists!")
if os.path.exists(outputName + ".db"):
raise Exception, (outputName + ".db exists!")
raise Exception(outputName + ".db exists!")
if os.path.exists(outputName + "_correlations.txt"):
raise Exception, (outputName + "_correlations.txt exists!")
raise Exception(outputName + "_correlations.txt exists!")

components = "xx", "xy", "xz", "xphix", "xphiy", "xphiz", "yy", "yz", "yphix", "yphiy", "yphiz", "zz", "zphix", "zphiy", "zphiz", "phixphix", "phixphiy", "phixphiz", "phiyphiy", "phiyphiz", "phizphiz"
for component in components:
Expand Down Expand Up @@ -91,7 +91,7 @@
abs(phixphiy/sqrt(phixphix)/sqrt(phiyphiy)), abs(phixphiz/sqrt(phixphix)/sqrt(phizphiz)),
abs(phiyphiz/sqrt(phiyphiy)/sqrt(phizphiz))]:
if correlation_coefficient > 1.:
raise Exception, "Correlations must not be larger than one!"
raise Exception("Correlations must not be larger than one!")

### Some useful mathematical transformations (why don't we have access to numpy?)

Expand Down

0 comments on commit fb81efe

Please sign in to comment.