Source code for pyop3.exceptions
import abc
[docs]
class Pyop3Exception(Exception, abc.ABC):
"""Base class for all pyop3 exceptions."""
[docs]
class InvalidIndexCountException(Pyop3Exception):
"""Exception raised when too few/many indices are used to index an object."""
[docs]
class SizeMismatchException(Pyop3Exception):
"""Exception raised when the size of an array does not match what is expected."""
[docs]
class ValueMismatchException(Pyop3Exception):
pass
[docs]
class MultipleUniqueEntriesException(Pyop3Exception):
pass
[docs]
class UnhashableObjectException(Pyop3Exception, TypeError):
pass
[docs]
class UnsupportedArrayException(Pyop3Exception, TypeError):
pass
[docs]
class EmptyIterableException(Pyop3Exception):
pass
[docs]
class NonUnitIterableException(Pyop3Exception):
pass
# {{{ expressions
[docs]
class ExpressionUnchangedException(Pyop3Exception):
pass
[docs]
class MissingVariableException(Pyop3Exception):
"""Exception raised when information about an axis variable is missing."""
# }}}
# {{{ axis trees
# NOTE: the same idea as InvalidIndexTargetException
[docs]
class IncompatibleAxisTargetException(Pyop3Exception):
pass
[docs]
class NonUnitAxisException(Pyop3Exception):
pass
# }}}
# {{{ indexing
[docs]
class InvalidMapTargetException(Pyop3Exception):
pass
[docs]
class LoopContextSensitiveException(Pyop3Exception):
"""Exception raised when an index is sensitive to the loop index."""
[docs]
class UnspecialisedCalledMapException(Pyop3Exception):
"""Exception raised when an unspecialised map is used in place of a specialised one.
This is important for cases like closure(cell) where the result can be either
a set of points, or sets of cells, edges, and vertices. We say that it is 'unspecialised'
because it cannot be put into an `IndexTree` and instead should yield two trees as
an `IndexForest`.
"""
[docs]
class InvalidIndexTargetException(Pyop3Exception):
"""Exception raised when we try to match index information to a mismatching axis tree."""
# }}}
# {{{ caching
[docs]
class CacheException(Pyop3Exception):
"""Error during caching."""
# }}}
# {{{ code generation
[docs]
class CompilationException(Pyop3Exception):
"""Error during compilation."""
[docs]
class InvalidIntentException(Pyop3Exception):
"""Error raised if an argument cannot be accessed using the declared intent."""
[docs]
class InvalidScalarTypeException(Pyop3Exception, TypeError):
"""Exception raised when an operation does not support the scalar type of its data."""
# }}}
# {{{ parallel
[docs]
class CommNotFoundException(Pyop3Exception):
pass
[docs]
class CommMismatchException(Pyop3Exception):
"""Exception raised when MPI communicators do not match."""
# }}}
# to organise/check:
[docs]
class ExpectedLinearAxisTreeException(Pyop3Exception):
...
[docs]
class ContextMismatchException(Pyop3Exception):
pass
[docs]
class InvalidExpressionException(Pyop3Exception):
pass
[docs]
class InvalidArrayAccessException(Pyop3Exception):
"""Exception raised when a data structure cannot be viewed as an array."""