__all__ = ("CCLError", "CCLWarning", "CCLDeprecationWarning",)
import warnings
[docs]class CCLError(RuntimeError):
"""A CCL-specific RuntimeError"""
def __repr__(self):
return "pyccl.CCLError(%r)" % (str(self))
def __eq__(self, other):
return repr(self) == repr(other)
def __hash__(self):
return hash(repr(self))
[docs]class CCLWarning(RuntimeWarning):
"""A CCL-specific warning"""
def __repr__(self):
return "pyccl.CCLWarning(%r)" % (str(self))
def __eq__(self, other):
return repr(self) == repr(other)
def __hash__(self):
return hash(repr(self))
[docs]class CCLDeprecationWarning(DeprecationWarning):
"""A CCL-specific deprecation warning."""
def __repr__(self):
return "pyccl.CCLDeprecationWarning(%r)" % (str(self))
def __eq__(self, other):
return repr(self) == repr(other)
def __hash__(self):
return hash(repr(self))
[docs] @classmethod
def enable(cls):
warnings.simplefilter("always")
[docs] @classmethod
def disable(cls):
warnings.filterwarnings(action="ignore", category=cls)