diff --git a/GPy/testing/kernel_tests.py b/GPy/testing/kernel_tests.py index c1bb9265..3b09d6e7 100644 --- a/GPy/testing/kernel_tests.py +++ b/GPy/testing/kernel_tests.py @@ -282,7 +282,7 @@ class KernelGradientTestsContinuous(unittest.TestCase): try: k.K(self.X) except AssertionError: - raise AssertionError, "k.K(X) should run on self.D-1 dimension" + raise AssertionError("k.K(X) should run on self.D-1 dimension") def test_Matern52(self): k = GPy.kern.Matern52(self.D) diff --git a/GPy/util/caching.py b/GPy/util/caching.py index 16adc320..b1419aec 100644 --- a/GPy/util/caching.py +++ b/GPy/util/caching.py @@ -148,10 +148,10 @@ class Cacher(object): return Cacher(self.operation, self.limit, self.ignore_args, self.force_kwargs) def __getstate__(self, memo=None): - raise NotImplementedError, "Trying to pickle Cacher object with function {}, pickling functions not possible.".format(str(self.operation)) + raise NotImplementedError("Trying to pickle Cacher object with function {}, pickling functions not possible.".format(str(self.operation))) def __setstate__(self, memo=None): - raise NotImplementedError, "Trying to pickle Cacher object with function {}, pickling functions not possible.".format(str(self.operation)) + raise NotImplementedError("Trying to pickle Cacher object with function {}, pickling functions not possible.".format(str(self.operation))) @property def __name__(self): diff --git a/GPy/util/choleskies.py b/GPy/util/choleskies.py index cc3a7f75..606229f7 100644 --- a/GPy/util/choleskies.py +++ b/GPy/util/choleskies.py @@ -10,7 +10,7 @@ def safe_root(N): i = np.sqrt(N) j = int(i) if i != j: - raise ValueError, "N is not square!" + raise ValueError("N is not square!") return j def flat_to_triang(flat): diff --git a/GPy/util/config.py b/GPy/util/config.py index 6dad46c8..8496fe36 100644 --- a/GPy/util/config.py +++ b/GPy/util/config.py @@ -20,4 +20,4 @@ user_file = os.path.join(home,'.gpy_user.cfg') config.readfp(open(default_file)) config.read([local_file, user_file]) if not config: - raise ValueError, "No configuration file found at either " + user_file + " or " + local_file + " or " + default_file + "." + raise ValueError("No configuration file found at either " + user_file + " or " + local_file + " or " + default_file + ".") diff --git a/GPy/util/datasets.py b/GPy/util/datasets.py index 3ba46f52..2648dd8d 100644 --- a/GPy/util/datasets.py +++ b/GPy/util/datasets.py @@ -785,7 +785,7 @@ def hapmap3(data_set='hapmap3'): from sys import stdout import bz2 except ImportError as i: - raise i, "Need pandas for hapmap dataset, make sure to install pandas (http://pandas.pydata.org/) before loading the hapmap dataset" + raise i("Need pandas for hapmap dataset, make sure to install pandas (http://pandas.pydata.org/) before loading the hapmap dataset") dir_path = os.path.join(data_path,'hapmap3') hapmap_file_name = 'hapmap3_r2_b36_fwd.consensus.qc.poly' diff --git a/GPy/util/linalg.py b/GPy/util/linalg.py index d7ad5d61..04b341f3 100644 --- a/GPy/util/linalg.py +++ b/GPy/util/linalg.py @@ -91,7 +91,7 @@ def jitchol(A, maxtries=5): else: diagA = np.diag(A) if np.any(diagA <= 0.): - raise linalg.LinAlgError, "not pd: non-positive diagonal elements" + raise linalg.LinAlgError("not pd: non-positive diagonal elements") jitter = diagA.mean() * 1e-6 num_tries = 1 while num_tries <= maxtries and np.isfinite(jitter): @@ -105,7 +105,7 @@ def jitchol(A, maxtries=5): import traceback logging.warning('\n'.join(['Added {} rounds of jitter, jitter of {:.10e}'.format(num_tries-1, jitter), ' in '+traceback.format_list(traceback.extract_stack(limit=2)[-2:-1])[0][2:]])) - raise linalg.LinAlgError, "not positive definite, even with jitter." + raise linalg.LinAlgError("not positive definite, even with jitter.") # def dtrtri(L, lower=1): # """ diff --git a/GPy/util/ln_diff_erfs.py b/GPy/util/ln_diff_erfs.py index 582a4585..c1137283 100644 --- a/GPy/util/ln_diff_erfs.py +++ b/GPy/util/ln_diff_erfs.py @@ -35,7 +35,7 @@ def ln_diff_erfs(x1, x2, return_sign=False): elif x2.size==1: v = np.zeros(x1.shape) else: - raise ValueError, "This function does not broadcast unless provided with a scalar." + raise ValueError("This function does not broadcast unless provided with a scalar.") if x1.size == 1: x1 = np.tile(x1, x2.shape) diff --git a/GPy/util/mocap.py b/GPy/util/mocap.py index 58662cf9..bcc3c029 100644 --- a/GPy/util/mocap.py +++ b/GPy/util/mocap.py @@ -174,7 +174,7 @@ class skeleton(tree): return connection def to_xyz(self, channels): - raise NotImplementedError, "this needs to be implemented to use the skeleton class" + raise NotImplementedError("this needs to be implemented to use the skeleton class") def finalize(self):