montepy.exceptions 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, such as cell importance or tally type, are set for a particle type not in the problem's mode. |
|
Base class for incongruencies between particle types in problem mode, cell importances, and tallies |
|
Raised when multiple conflicting parameters are given. |
|
Raised when the constants of a Surface are non-conform, but do not raise an error with MCNP. |
|
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.exceptions.BrokenObjectLinkError(parent_type, parent_number, child_type, child_number)#
Bases:
MalformedInputError
Raised 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
- with_traceback()#
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- args#
- exception montepy.exceptions.IllegalState(message)#
Bases:
ValueError
Raised 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
- with_traceback()#
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- args#
- exception montepy.exceptions.LineExpansionWarning#
Bases:
Warning
Warning 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
- with_traceback()#
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- args#
- exception montepy.exceptions.LineOverRunWarning(message)#
Bases:
UserWarning
Raised 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
- with_traceback()#
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- args#
- exception montepy.exceptions.MalformedInputError(input, message)#
Bases:
ValueError
Raised 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
- with_traceback()#
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- args#
- exception montepy.exceptions.NumberConflictError(message)#
Bases:
Exception
Raised 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
- with_traceback()#
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- args#
- exception montepy.exceptions.ParsingError(input, message, error_queue)#
Bases:
MalformedInputError
Raised 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
- with_traceback()#
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- args#
- exception montepy.exceptions.ParticleTypeNotInCell(message)#
Bases:
ParticleTypeWarning
Raised 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
- with_traceback()#
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- args#
- exception montepy.exceptions.ParticleTypeNotInProblem(message)#
Bases:
ParticleTypeWarning
Raised when data, such as cell importance or tally type, 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
- with_traceback()#
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- args#
- exception montepy.exceptions.ParticleTypeWarning(message)#
Bases:
Warning
Base class for incongruencies between particle types in problem mode, cell importances, and tallies
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
- with_traceback()#
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- args#
- exception montepy.exceptions.RedundantParameterSpecification(key, new_value)#
Bases:
ValueError
Raised when multiple conflicting parameters are given.
e.g.,
1 0 -1 imp:n=5 imp:n=0
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
- with_traceback()#
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- args#
- exception montepy.exceptions.SurfaceConstantsWarning(message)#
Bases:
UserWarning
Raised when the constants of a Surface are non-conform, but do not raise an error with MCNP.
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
- with_traceback()#
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- args#
- exception montepy.exceptions.UnknownElement(missing_val)#
Bases:
ValueError
Raised 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
- with_traceback()#
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- args#
- exception montepy.exceptions.UnsupportedFeature(message, input=None, error_queue=None)#
Bases:
ParsingError
Raised 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
- with_traceback()#
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- args#
- montepy.exceptions.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.