From 42162f404323ff2bbf3d65a62c4ccdb4633736b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois-Michel=20De=20Rainville?= Date: Wed, 30 May 2018 16:36:38 -0400 Subject: [PATCH] Show warning only if hypervolume is called --- deap/tools/_hypervolume/pyhv.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/deap/tools/_hypervolume/pyhv.py b/deap/tools/_hypervolume/pyhv.py index 723f8e018..f977f61c7 100644 --- a/deap/tools/_hypervolume/pyhv.py +++ b/deap/tools/_hypervolume/pyhv.py @@ -28,14 +28,12 @@ import numpy -warnings.simplefilter("once", ImportWarning) -warnings.warn("Falling back to the python version of hypervolume " - "module. Expect this to be very slow.", ImportWarning) - def hypervolume(pointset, ref): """Compute the absolute hypervolume of a *pointset* according to the reference point *ref*. """ + warnings.warn("Falling back to the python version of hypervolume " + "module. Expect this to be very slow.", RuntimeWarning) hv = _HyperVolume(ref) return hv.compute(pointset)