openscm_calibration.exceptions#
Exceptions that are used throughout
Classes:
| Name | Description |
|---|---|
MismatchLengthError |
Raised when an object should have the same length as something else, but doesn't |
MissingOptionalDependencyError |
Raised when an optional dependency is missing |
MissingValueError |
Raised when a sequence is missing a value(s) that we expect it to have |
NotExpectedAllSameValueError |
Raised when the values are not all the same expected value |
NotExpectedValueError |
Raised when the value is not what we expect |
MismatchLengthError #
Bases: ValueError
Raised when an object should have the same length as something else, but doesn't
Methods:
| Name | Description |
|---|---|
__init__ |
Initialise the error |
Source code in src/openscm_calibration/exceptions.py
__init__ #
Initialise the error
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name of the thing being referenced (variable, attribute etc.) |
required |
length
|
int
|
The length of the thing being referenced |
required |
expected_name
|
Any
|
The name of the thing we expect to match |
required |
expected_length
|
int
|
The expected length of the thing |
required |
Source code in src/openscm_calibration/exceptions.py
MissingOptionalDependencyError #
Bases: ImportError
Raised when an optional dependency is missing
For example, plotting dependencies like seaborn
Methods:
| Name | Description |
|---|---|
__init__ |
Initialise the error |
Source code in src/openscm_calibration/exceptions.py
__init__ #
Initialise the error
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
callable_name
|
str
|
The name of the callable that requires the dependency |
required |
requirement
|
str
|
The name of the requirement |
required |
Source code in src/openscm_calibration/exceptions.py
MissingValueError #
Bases: ValueError
Raised when a sequence is missing a value(s) that we expect it to have
Methods:
| Name | Description |
|---|---|
__init__ |
Initialise the error |
Source code in src/openscm_calibration/exceptions.py
__init__ #
Initialise the error
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name of the thing being referenced (variable, attribute etc.) |
required |
vals
|
Sequence[Any]
|
The values in |
required |
missing_vals
|
Any
|
The value(s) that are missing |
required |
Source code in src/openscm_calibration/exceptions.py
NotExpectedAllSameValueError #
Bases: ValueError
Raised when the values are not all the same expected value
Methods:
| Name | Description |
|---|---|
__init__ |
Initialise the error |
Source code in src/openscm_calibration/exceptions.py
__init__ #
Initialise the error
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref_name
|
str
|
The name of the thing being referenced (variable, attribute etc.) |
required |
expected_val
|
Any
|
The value we expected all elements of |
required |
Source code in src/openscm_calibration/exceptions.py
NotExpectedValueError #
Bases: ValueError
Raised when the value is not what we expect
This is a very verbose version of an assertion error
Methods:
| Name | Description |
|---|---|
__init__ |
Initialise the error |
Source code in src/openscm_calibration/exceptions.py
__init__ #
Initialise the error
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref_name
|
str
|
The name of the thing being referenced (variable, attribute etc.) |
required |
val
|
Any
|
The value of |
required |
expected_val
|
Any
|
The value we expected |
required |