gruvoc.errors: Error classes for gruvoc package¶
This module provides a collection of error types relevant to the
gruvoc package. They are essentially the same as standard error
types such as KeyError, TypeError, etc. but with an
extra parent of GruvocError to enable catching all errors
specifically raised by this package
- exception cape.gruvoc.errors.GruvocAttributeError¶
Bases:
AttributeError,GruvocErrorError related to accessing attributes
Inherits from
AttributeErrorandGruvocError.
- exception cape.gruvoc.errors.GruvocError¶
Bases:
ExceptionParent error class for
gruvocerrorsInherits from
Exception
- exception cape.gruvoc.errors.GruvocFileNotFoundError¶
Bases:
FileNotFoundError,GruvocErrorException for missing but required file
Inherits from
FileNotFoundErrorand :class;`GruvocError`
- exception cape.gruvoc.errors.GruvocJSONError¶
Bases:
ValueError,GruvocErrorException class for errors while parsing JSON files
Inherits from
ValueErrorandGruvocError
- exception cape.gruvoc.errors.GruvocKeyError¶
Bases:
KeyError,GruvocErrorException for missing key in
gruvocInherits from
KeyErrorandGruvocError
- exception cape.gruvoc.errors.GruvocNameError¶
Bases:
NameError,GruvocErrorError for badly named options in
gruvocInherits from
NameErrorandGruvocError
- exception cape.gruvoc.errors.GruvocNotImplementedError¶
Bases:
NotImplementedError,GruvocErrorError for features not currently implemented
- exception cape.gruvoc.errors.GruvocSystemError¶
Bases:
SystemError,GruvocErrorException for system errors raised by
gruvoc
- exception cape.gruvoc.errors.GruvocTypeError¶
Bases:
TypeError,GruvocErrorException for unexpected type of parameter in
gruvoc
- exception cape.gruvoc.errors.GruvocValueError¶
Bases:
ValueError,GruvocErrorException for unexpected value of parameter in
gruvoc
- cape.gruvoc.errors.assert_isfile(fname: str)¶
Ensure that a file exists
- Call:
>>> assert_isfile(fname)
- Inputs:
- fname:
str Name of a file
- fname:
- Raises:
GruvocFileNotFoundErrorif fname does not exist- Versions:
2023-10-25
@ddalle: v1.0
- cape.gruvoc.errors.assert_isinstance(obj, cls_or_tuple, desc=None)¶
Conveniently check types
Applies
isinstance(obj, cls_or_tuple)but also constructs a :class;`TypeError` and appropriate message if test fails- Call:
>>> assert_isinstance(obj, cls, desc=None) >>> assert_isinstance(obj, cls_tuple, desc=None)
- Inputs:
- Raises:
- cape.gruvoc.errors.assert_shape(v: ndarray, size: int, axis: int = 1, nd: int | None = None, name: str | None = None)¶