dantro.exceptions module

Custom dantro exception classes.

exception dantro.exceptions.DantroError[source]

Bases: Exception

Base class for all dantro-related errors

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception dantro.exceptions.DantroWarning[source]

Bases: UserWarning

Base class for all dantro-related warnings

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception dantro.exceptions.DantroMessagingException[source]

Bases: dantro.exceptions.DantroError

Base class for exceptions that are used for messaging

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception dantro.exceptions.UnexpectedTypeWarning[source]

Bases: dantro.exceptions.DantroWarning

Given when there was an unexpected type passed to a data container.

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception dantro.exceptions.ItemAccessError(obj: AbstractDataContainer, *, key: str, show_hints: bool = True, prefix: str = None, suffix: str = None)[source]

Bases: KeyError, IndexError

Raised upon bad access via __getitem__ or similar magic methods.

This derives from both native exceptions KeyError and IndexError as these errors may be equivalent in the context of the dantro data tree, which is averse to the underlying storage container.

See BaseDataGroup for example usage.

__init__(obj: AbstractDataContainer, *, key: str, show_hints: bool = True, prefix: str = None, suffix: str = None)[source]

Set up an ItemAccessError object, storing some metadata that is used to create a helpful error message.

Parameters
  • obj (AbstractDataContainer) – The object from which item access was attempted but failed

  • key (str) – The key with which __getitem__ was called

  • show_hints (bool, optional) – Whether to show hints in the error message, e.g. available keys or “Did you mean …?”

  • prefix (str, optional) – A prefix string for the error message

  • suffix (str, optional) – A suffix string for the error message

Raises

TypeError – Upon obj without attributes logstr and path; or key not being a string.

__str__() → str[source]

Parse an error message, using the additional information to give hints on where the error occurred and how it can be resolved.

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception dantro.exceptions.DataOperationWarning[source]

Bases: dantro.exceptions.DantroWarning

Base class for warnings related to data operations

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception dantro.exceptions.DataOperationError[source]

Bases: dantro.exceptions.DantroError

Base class for errors related to data operations

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception dantro.exceptions.BadOperationName[source]

Bases: dantro.exceptions.DataOperationError, ValueError

Raised upon bad data operation name

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception dantro.exceptions.DataOperationFailed[source]

Bases: dantro.exceptions.DataOperationError, RuntimeError

Raised upon failure to apply a data operation

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception dantro.exceptions.DAGError[source]

Bases: dantro.exceptions.DantroError

For errors in the data transformation framework

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception dantro.exceptions.MissingDAGReference[source]

Bases: dantro.exceptions.DAGError, ValueError

If there was a missing DAG reference

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception dantro.exceptions.MissingDAGTag[source]

Bases: dantro.exceptions.MissingDAGReference, ValueError

Raised upon bad tag names

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception dantro.exceptions.MissingDAGNode[source]

Bases: dantro.exceptions.MissingDAGReference, ValueError

Raised upon bad node index

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception dantro.exceptions.DataManagerError[source]

Bases: dantro.exceptions.DantroError

All DataManager exceptions derive from this one

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception dantro.exceptions.RequiredDataMissingError[source]

Bases: dantro.exceptions.DataManagerError

Raised if required data was missing.

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception dantro.exceptions.MissingDataError[source]

Bases: dantro.exceptions.DataManagerError

Raised if data was missing, but is not required.

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception dantro.exceptions.ExistingDataError[source]

Bases: dantro.exceptions.DataManagerError

Raised if data already existed.

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception dantro.exceptions.ExistingGroupError[source]

Bases: dantro.exceptions.DataManagerError

Raised if a group already existed.

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception dantro.exceptions.LoaderError[source]

Bases: dantro.exceptions.DataManagerError

Raised if a data loader was not available

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception dantro.exceptions.DataLoadingError[source]

Bases: dantro.exceptions.DataManagerError

Raised if loading data failed for some reason

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception dantro.exceptions.MissingDataWarning[source]

Bases: dantro.exceptions.DantroWarning

Used as warning instead of MissingDataError

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception dantro.exceptions.ExistingDataWarning[source]

Bases: dantro.exceptions.DantroWarning

If there was data already existing …

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception dantro.exceptions.NoMatchWarning[source]

Bases: dantro.exceptions.DantroWarning

If there was no regex match

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception dantro.exceptions.PlottingError[source]

Bases: dantro.exceptions.DantroError

Custom exception class for all plotting errors

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception dantro.exceptions.PlotConfigError[source]

Bases: ValueError, dantro.exceptions.PlottingError

Raised when there were errors in the plot configuration

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception dantro.exceptions.InvalidCreator[source]

Bases: ValueError, dantro.exceptions.PlottingError

Raised when an invalid creator was specified

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception dantro.exceptions.PlotCreatorError[source]

Bases: dantro.exceptions.PlottingError

Raised when an error occured in a plot creator

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception dantro.exceptions.SkipPlot(what: str = '')[source]

Bases: dantro.exceptions.DantroMessagingException

A custom exception class that denotes that a plot is to be skipped.

This is typically handled by the PlotManager and can thus be raised anywhere below it: in the plot creators, in the user-defined plotting functions, …

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception dantro.exceptions.EnterAnimationMode[source]

Bases: dantro.exceptions.DantroMessagingException

An exception that is used to convey to any ExternalPlotCreator or derived creator that animation mode is to be entered instead of a regular single-file plot.

It can and should be invoked via enable_animation().

This exception can be raised from within a plot function to dynamically decide whether animation should happen or not. Its counterpart is ExitAnimationMode.

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception dantro.exceptions.ExitAnimationMode[source]

Bases: dantro.exceptions.DantroMessagingException

An exception that is used to convey to any ExternalPlotCreator or derived creator that animation mode is to be exited and a regular single-file plot should be carried out.

It can and should be invoked via disable_animation().

This exception can be raised from within a plot function to dynamically decide whether animation should happen or not. Its counterpart is ExitAnimationMode.

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception dantro.exceptions.PlotHelperError(upstream_error: Exception, *, name: str, params: dict, ax_coords: Tuple[int, int] = None)[source]

Bases: dantro.exceptions.PlotConfigError

Raised upon failure to invoke a specific plot helper function, this custom exception type stores metadata on the helper invocation in order to generate a useful error message.

__init__(upstream_error: Exception, *, name: str, params: dict, ax_coords: Tuple[int, int] = None)[source]

Initializes a PlotHelperError

__str__()[source]

Generates an error message for this particular helper

property docstring

Returns the docstring of this helper function

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception dantro.exceptions.PlotHelperErrors(*errors, show_docstrings: bool = True)[source]

Bases: ValueError

This custom exception type gathers multiple individual instances of PlotHelperError.

__init__(*errors, show_docstrings: bool = True)[source]

Bundle multiple PlotHelperErrors together

Parameters
  • *errors – The individual instances of PlotHelperError

  • show_docstrings (bool, optional) – Whether to show docstrings in the error message.

property errors
__str__() → str[source]

Generates a combined error message for all registered errors

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.