Commit 4641bfd3 authored by Médéric Boquien's avatar Médéric Boquien Committed by Yannick Roehlly

Make the source code more compatible with Python 3. As far as I understand the...

Make the source code more compatible with Python 3. As far as I understand the documentation, this should be harmless for Python 2.
parent 030d68d6
......@@ -77,7 +77,7 @@ def igm_transmission_meiksin(wavelength, redshift):
# The redshift must be strictly positive
if redshift <= 0.:
raise StandardError("The redshift provided must be strictly positive "
raise Exception("The redshift provided must be strictly positive "
"<{}>.".format(redshift))
n_transitions_low = 10
......
......@@ -50,13 +50,13 @@ class Redshifting(CreationModule):
# If the SED is already redshifted, raise an error.
if sed.redshift > 0:
raise StandardError("The SED is already redshifted <z={}>."
raise Exception("The SED is already redshifted <z={}>."
.format(sed.redshift))
# Raise an error when applying a negative redshift. This module is
# not for blue-shifting.
if redshift < 0:
raise StandardError("The redshift provided is negative <{}>."
raise Exception("The redshift provided is negative <{}>."
.format(redshift))
# We redshift directly the SED wavelength grid
......
......@@ -229,7 +229,7 @@ class Database(object):
if self.is_writable:
BASE.metadata.create_all(ENGINE)
else:
raise StandardError('The database is not writable.')
raise Exception('The database is not writable.')
def close(self):
""" Close the connection to the database
......@@ -255,7 +255,7 @@ class Database(object):
self.session.rollback()
raise DatabaseInsertError('The filter is already in the base.')
else:
raise StandardError('The database is not writable.')
raise Exception('The database is not writable.')
def add_ssp_m2005(self, ssp_m2005):
"""
......@@ -275,7 +275,7 @@ class Database(object):
self.session.rollback()
raise DatabaseInsertError('The SSP is already in the base.')
else:
raise StandardError('The database is not writable.')
raise Exception('The database is not writable.')
def add_ssp_bc03(self, ssp_bc03):
"""
......@@ -295,7 +295,7 @@ class Database(object):
self.session.rollback()
raise DatabaseInsertError('The SSP is already in the base.')
else:
raise StandardError('The database is not writable.')
raise Exception('The database is not writable.')
def add_dh2002_infrared_templates(self, data):
"""
......@@ -327,7 +327,7 @@ class Database(object):
raise DatabaseInsertError(
'The template is already in the base.')
else:
raise StandardError('The database is not writable.')
raise Exception('The database is not writable.')
def add_dale2014(self, iragn):
"""
......@@ -349,7 +349,7 @@ class Database(object):
raise DatabaseInsertError(
'The Dale2014 template is already in the base.')
else:
raise StandardError('The database is not writable.')
raise Exception('The database is not writable.')
def add_dl2007(self, model):
"""
......@@ -369,7 +369,7 @@ class Database(object):
raise DatabaseInsertError(
'The DL07 model is already in the base.')
else:
raise StandardError('The database is not writable.')
raise Exception('The database is not writable.')
def add_fritz2006_agn(self, agn):
"""
......@@ -389,7 +389,7 @@ class Database(object):
raise DatabaseInsertError(
'The agn model is already in the base.')
else:
raise StandardError('The database is not writable.')
raise Exception('The database is not writable.')
def get_filter(self, name):
"""
......
......@@ -160,7 +160,7 @@ class Configuration(object):
# Check that we don't have an error column without the associated flux
for column in column_list:
if column.endswith('_err') and (column[:-4] not in column_list):
raise StandardError("The observation table as a {} column "
raise Exception("The observation table as a {} column "
"but no {} column.".format(column,
column[:-4]))
......
......@@ -37,7 +37,7 @@ def read_table(file_):
try:
table = Table.read(file_, format="ascii")
except InconsistentTableError:
raise StandardError("The file <{}> can not be parsed as a data "
raise Exception("The file <{}> can not be parsed as a data "
"table.".format(file_))
return table
Markdown is supported
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