Skip to content

Commit

Permalink
Do modern exceptions after conflicts resolved
Browse files Browse the repository at this point in the history
  • Loading branch information
ericvaandering committed Oct 30, 2015
1 parent ad1eed1 commit 3975ea7
Show file tree
Hide file tree
Showing 245 changed files with 2,276 additions and 2,296 deletions.
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Loading

0 comments on commit 3975ea7

Please sign in to comment.