montepy.errors module#
Exceptions:
|
Raised when the referenced object does not exist in the input file. |
|
Raised when an object can't be printed out due to an illegal state. |
|
Warning for when a field or line expands that may damage user formatting. |
|
Raised when non-comment inputs exceed the allowed line length in an input. |
|
Raised when there is an error with the MCNP input not related to the parser. |
|
Raised when there is a conflict in number spaces |
|
Raised when there is an error parsing the MCNP input at the SLY parsing layer. |
|
Raised when data for importance data for a particle in the problem is not provided for a cell. |
|
Raised when data are set for a particle type not in the problem's mode. |
|
Raised when multiple conflicting parameters are given. |
|
Raised when an undefined element is used. |
|
Raised when MCNP syntax that is not supported is found |
Functions:
|
Adds additional context to an Exception raised by an |
- exception montepy.errors.BrokenObjectLinkError(parent_type, parent_number, child_type, child_number)#
Bases:
MalformedInputErrorRaised when the referenced object does not exist in the input file.
Methods:
Exception.add_note(note) -- add a note to the exception
Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.
Attributes:
- add_note()#
Exception.add_note(note) – add a note to the exception
- args#
- with_traceback()#
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- exception montepy.errors.IllegalState(message)#
Bases:
ValueErrorRaised when an object can’t be printed out due to an illegal state.
Methods:
Exception.add_note(note) -- add a note to the exception
Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.
Attributes:
- add_note()#
Exception.add_note(note) – add a note to the exception
- args#
- with_traceback()#
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- exception montepy.errors.LineExpansionWarning(message)#
Bases:
WarningWarning for when a field or line expands that may damage user formatting.
Methods:
Exception.add_note(note) -- add a note to the exception
Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.
Attributes:
- add_note()#
Exception.add_note(note) – add a note to the exception
- args#
- with_traceback()#
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- exception montepy.errors.LineOverRunWarning(message)#
Bases:
UserWarningRaised when non-comment inputs exceed the allowed line length in an input.
Methods:
Exception.add_note(note) -- add a note to the exception
Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.
Attributes:
- add_note()#
Exception.add_note(note) – add a note to the exception
- args#
- with_traceback()#
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- exception montepy.errors.MalformedInputError(input, message)#
Bases:
ValueErrorRaised when there is an error with the MCNP input not related to the parser.
Methods:
Exception.add_note(note) -- add a note to the exception
Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.
Attributes:
- add_note()#
Exception.add_note(note) – add a note to the exception
- args#
- with_traceback()#
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- exception montepy.errors.NumberConflictError(message)#
Bases:
ExceptionRaised when there is a conflict in number spaces
Methods:
Exception.add_note(note) -- add a note to the exception
Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.
Attributes:
- add_note()#
Exception.add_note(note) – add a note to the exception
- args#
- with_traceback()#
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- exception montepy.errors.ParsingError(input, message, error_queue)#
Bases:
MalformedInputErrorRaised when there is an error parsing the MCNP input at the SLY parsing layer.
Methods:
Exception.add_note(note) -- add a note to the exception
Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.
Attributes:
- add_note()#
Exception.add_note(note) – add a note to the exception
- args#
- with_traceback()#
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- exception montepy.errors.ParticleTypeNotInCell(message)#
Bases:
ValueErrorRaised when data for importance data for a particle in the problem is not provided for a cell.
Methods:
Exception.add_note(note) -- add a note to the exception
Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.
Attributes:
- add_note()#
Exception.add_note(note) – add a note to the exception
- args#
- with_traceback()#
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- exception montepy.errors.ParticleTypeNotInProblem(message)#
Bases:
ValueErrorRaised when data are set for a particle type not in the problem’s mode.
Methods:
Exception.add_note(note) -- add a note to the exception
Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.
Attributes:
- add_note()#
Exception.add_note(note) – add a note to the exception
- args#
- with_traceback()#
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- exception montepy.errors.RedundantParameterSpecification(key, new_value)#
Bases:
ValueErrorRaised when multiple conflicting parameters are given.
e.g.,
1 0 -1 imp:n=5 imp:n=0Methods:
Exception.add_note(note) -- add a note to the exception
Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.
Attributes:
- add_note()#
Exception.add_note(note) – add a note to the exception
- args#
- with_traceback()#
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- exception montepy.errors.UnknownElement(missing_val)#
Bases:
ValueErrorRaised when an undefined element is used.
Methods:
Exception.add_note(note) -- add a note to the exception
Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.
Attributes:
- add_note()#
Exception.add_note(note) – add a note to the exception
- args#
- with_traceback()#
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- exception montepy.errors.UnsupportedFeature(message)#
Bases:
NotImplementedErrorRaised when MCNP syntax that is not supported is found
Methods:
Exception.add_note(note) -- add a note to the exception
Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.
Attributes:
- add_note()#
Exception.add_note(note) – add a note to the exception
- args#
- with_traceback()#
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- montepy.errors.add_line_number_to_exception(error, broken_robot)#
Adds additional context to an Exception raised by an
MCNP_Object.This will add the line, file name, and the input lines to the error.
- Parameters:
error (Exception) – The error that was raised.
broken_robot (MCNP_Object) – The parent object that had the error raised.
- Raises:
Exception – … that’s the whole point.