| 1 |
"""PyVista specific errors.""" |
| 2 |
|
| 3 |
from __future__ import annotations |
| 4 |
|
| 5 |
|
| 6 |
class NotAllTrianglesError(ValueError): |
| 7 |
"""Exception when a mesh does not contain all triangles. |
| 8 |
|
| 9 |
Parameters |
| 10 |
---------- |
| 11 |
message : str |
| 12 |
Error message. |
| 13 |
|
| 14 |
""" |
| 15 |
|
| 16 |
def __init__(self, message='Mesh must consist of only triangles') -> None: |
| 17 |
"""Empty init.""" |
| 18 |
ValueError.__init__(self, message) |
| 19 |
|
| 20 |
|
| 21 |
class DeprecationError(RuntimeError): |
| 22 |
"""Used for deprecated methods and functions. |
| 23 |
|
| 24 |
Parameters |
| 25 |
---------- |
| 26 |
message : str |
| 27 |
Error message. |
| 28 |
|
| 29 |
""" |
| 30 |
|
| 31 |
def __init__(self, message='This feature has been deprecated') -> None: |
| 32 |
"""Empty init.""" |
| 33 |
RuntimeError.__init__(self, message) |
| 34 |
|
| 35 |
|
| 36 |
class VTKVersionError(RuntimeError): |
| 37 |
"""Requested feature is not supported by the installed VTK version. |
| 38 |
|
| 39 |
Parameters |
| 40 |
---------- |
| 41 |
message : str |
| 42 |
Error message. |
| 43 |
|
| 44 |
""" |
| 45 |
|
| 46 |
def __init__( |
| 47 |
self, |
| 48 |
message='The requested feature is not supported by the installed VTK version.', |
| 49 |
) -> None: # numpydoc ignore=PR01,RT01 |
| 50 |
"""Empty init.""" |
| 51 |
RuntimeError.__init__(self, message) |
| 52 |
|
| 53 |
|
| 54 |
class PointSetNotSupported(TypeError): # noqa: N818 |
| 55 |
"""Requested filter or property is not supported by the PointSet class. |
| 56 |
|
| 57 |
Parameters |
| 58 |
---------- |
| 59 |
message : str |
| 60 |
Error message. |
| 61 |
|
| 62 |
""" |
| 63 |
|
| 64 |
def __init__( |
| 65 |
self, |
| 66 |
message='The requested operation is not supported for PointSets.', |
| 67 |
) -> None: # numpydoc ignore=PR01,RT01 |
| 68 |
"""Empty init.""" |
| 69 |
TypeError.__init__(self, message) |
| 70 |
|
| 71 |
|
| 72 |
class PointSetCellOperationError(PointSetNotSupported): |
| 73 |
"""Requested filter or property is not supported by the PointSet class. |
| 74 |
|
| 75 |
Parameters |
| 76 |
---------- |
| 77 |
message : str |
| 78 |
Error message. |
| 79 |
|
| 80 |
""" |
| 81 |
|
| 82 |
def __init__( |
| 83 |
self, |
| 84 |
message='Cell operations are not supported. PointSets contain no cells.', |
| 85 |
) -> None: # numpydoc ignore=PR01,RT01 |
| 86 |
"""Empty init.""" |
| 87 |
PointSetNotSupported.__init__(self, message) |
| 88 |
|
| 89 |
|
| 90 |
class PointSetDimensionReductionError(PointSetNotSupported): |
| 91 |
"""Requested filter or property is not supported by the PointSet class. |
| 92 |
|
| 93 |
Parameters |
| 94 |
---------- |
| 95 |
message : str |
| 96 |
Error message. |
| 97 |
|
| 98 |
""" |
| 99 |
|
| 100 |
def __init__( |
| 101 |
self, |
| 102 |
message='Slice and other dimension reducing filters are not supported on PointSets.', |
| 103 |
) -> None: # numpydoc ignore=PR01,RT01 |
| 104 |
"""Empty init.""" |
| 105 |
PointSetNotSupported.__init__(self, message) |
| 106 |
|
| 107 |
|
| 108 |
class PartitionedDataSetsNotSupported(TypeError): # noqa: N818 |
| 109 |
"""Requested filter or property is not supported by the PartitionedDataSets class. |
| 110 |
|
| 111 |
Parameters |
| 112 |
---------- |
| 113 |
message : str |
| 114 |
Error message. |
| 115 |
|
| 116 |
""" |
| 117 |
|
| 118 |
def __init__( |
| 119 |
self, |
| 120 |
message='The requested operation is not supported for PartitionedDataSetss.', |
| 121 |
) -> None: # numpydoc ignore=PR01,RT01 |
| 122 |
"""Empty init.""" |
| 123 |
TypeError.__init__(self, message) |
| 124 |
|
| 125 |
|
| 126 |
class MissingDataError(ValueError): |
| 127 |
"""Exception when data is missing, e.g. no active scalars can be set. |
| 128 |
|
| 129 |
Parameters |
| 130 |
---------- |
| 131 |
message : str |
| 132 |
Error message. |
| 133 |
|
| 134 |
""" |
| 135 |
|
| 136 |
def __init__(self, message='No data available.') -> None: |
| 137 |
"""Call the base class constructor with the custom message.""" |
| 138 |
super().__init__(message) |
| 139 |
|
| 140 |
|
| 141 |
class AmbiguousDataError(ValueError): |
| 142 |
"""Exception when data is ambiguous, e.g. multiple active scalars can be set. |
| 143 |
|
| 144 |
Parameters |
| 145 |
---------- |
| 146 |
message : str |
| 147 |
Error message. |
| 148 |
|
| 149 |
""" |
| 150 |
|
| 151 |
def __init__(self, message='Multiple data available.') -> None: |
| 152 |
"""Call the base class constructor with the custom message.""" |
| 153 |
super().__init__(message) |
| 154 |
|
| 155 |
|
| 156 |
class CellSizeError(ValueError): |
| 157 |
"""Exception when a cell array size is invalid. |
| 158 |
|
| 159 |
Parameters |
| 160 |
---------- |
| 161 |
message : str |
| 162 |
Error message. |
| 163 |
|
| 164 |
""" |
| 165 |
|
| 166 |
def __init__(self, message='Cell array size is invalid.') -> None: |
| 167 |
"""Call the base class constructor with the custom message.""" |
| 168 |
super().__init__(message) |
| 169 |
|
| 170 |
|
| 171 |
class PyVistaPipelineError(RuntimeError): |
| 172 |
"""Exception when a VTK pipeline runs into an issue. |
| 173 |
|
| 174 |
Parameters |
| 175 |
---------- |
| 176 |
message : str |
| 177 |
Error message. |
| 178 |
|
| 179 |
""" |
| 180 |
|
| 181 |
def __init__( |
| 182 |
self, |
| 183 |
message='VTK pipeline issue detected by PyVista.', |
| 184 |
) -> None: # numpydoc ignore=PR01,RT01 |
| 185 |
"""Call the base class constructor with the custom message.""" |
| 186 |
super().__init__(message) |
| 187 |
|
| 188 |
|
| 189 |
class PyVistaAttributeError(AttributeError): |
| 190 |
"""Exception when accessing an attribute that is not part of the PyVista API. |
| 191 |
|
| 192 |
Parameters |
| 193 |
---------- |
| 194 |
message : str |
| 195 |
Error message. |
| 196 |
|
| 197 |
""" |
| 198 |
|
| 199 |
def __init__( |
| 200 |
self, |
| 201 |
message='The attribute is not part of the PyVista API', |
| 202 |
) -> None: # numpydoc ignore=PR01,RT01 |
| 203 |
super().__init__(message) |
| 204 |
|
| 205 |
|
| 206 |
class InvalidMeshError(ValueError): |
| 207 |
"""Error for invalid mesh properties. |
| 208 |
|
| 209 |
.. versionadded:: 0.47 |
| 210 |
|
| 211 |
Parameters |
| 212 |
---------- |
| 213 |
message : str |
| 214 |
Error message. |
| 215 |
|
| 216 |
""" |
| 217 |
|
| 218 |
def __init__(self, message='Invalid mesh.') -> None: |
| 219 |
super().__init__(message) |
| 220 |
|
| 221 |
|
| 222 |
class VTKExecutionError(RuntimeError): |
| 223 |
"""Exception when a VTK output message is detected. |
| 224 |
|
| 225 |
.. versionadded:: 0.47 |
| 226 |
|
| 227 |
Parameters |
| 228 |
---------- |
| 229 |
message : str |
| 230 |
Error message. |
| 231 |
|
| 232 |
""" |
| 233 |
|
| 234 |
def __init__( |
| 235 |
self, |
| 236 |
message='VTK output message was detected by PyVista.', |
| 237 |
) -> None: # numpydoc ignore=PR01,RT01 |
| 238 |
"""Call the base class constructor with the custom message.""" |
| 239 |
super().__init__(message) |
| 240 |
|
| 241 |
|
| 242 |
class PyVistaDeprecationWarning(Warning): |
| 243 |
"""Non-supressed Deprecation Warning.""" |
| 244 |
|
| 245 |
|
| 246 |
class PyVistaFutureWarning(Warning): |
| 247 |
"""Non-supressed Future Warning.""" |
| 248 |
|
| 249 |
|
| 250 |
class PyVistaEfficiencyWarning(Warning): |
| 251 |
"""Efficiency warning.""" |
| 252 |
|
| 253 |
|
| 254 |
class VTKExecutionWarning(RuntimeWarning): |
| 255 |
"""Warning when a VTK output message is detected. |
| 256 |
|
| 257 |
.. versionadded:: 0.47 |
| 258 |
|
| 259 |
""" |
| 260 |
|
| 261 |
|
| 262 |
class InvalidMeshWarning(Warning): |
| 263 |
"""Warning for invalid mesh properties. |
| 264 |
|
| 265 |
.. versionadded:: 0.47 |
| 266 |
|
| 267 |
""" |