read_input#

class montepy.read_input(destination: str | PathLike | TextIOBase, mcnp_version: tuple[int, int, int] = (6, 3, 0), replace: bool = True, *, jit_parse: bool = True)#

Bases:

Reads the specified MCNP Input file.

The MCNP version must be a three component tuple e.g., (6, 2, 0) and (5, 1, 60).

Notes

if a stream is provided. It will not be closed by this function.

Warning

Probably should warn about just-in-time parsing.

Changed in version 1.2.0: Added jit_parse argument

Parameters:
  • destination (str | PathLike | TextIOBase) – the path to the input file to read, or a readable stream.

  • mcnp_version (tuple[int, int, int]) – The version of MCNP that the input is intended for.

  • replace (bool) – replace all non-ASCII characters with a space (0x20)

  • jit_parse (bool) – Whether to do just-in-time parsing

Returns:

The MCNP_Problem instance representing this file.

Return type:

MCNP_Problem

Raises: