Source code for dantro.data_ops.ctrl_ops

"""Implements operations that control the behaviour of the transformation or
pipeline in general, including functions that can be used for debugging."""

import logging
from typing import Any

from ..base import BaseDataContainer, BaseDataGroup
from ..exceptions import SkipPlot

log = logging.getLogger(__name__)

# -----------------------------------------------------------------------------


[docs] def raise_SkipPlot( cond: bool = True, *, reason: str = "", passthrough: Any = None ): """Raises :py:exc:`~dantro.exceptions.SkipPlot` to trigger that a plot is skipped without error, see :ref:`plot_mngr_skipping_plots`. If ``cond`` is False, this will do nothing but return the passthrough. Args: cond (bool, optional): Whether to actually raise the exception reason (str, optional): The reason for skipping, optional passthrough (Any, optional): A passthrough value which is returned if ``cond`` did not evaluate to True. """ if cond: raise SkipPlot(reason) return passthrough