In GitLab by @tjlaboss on Aug 26, 2022, 13:02
Several Python libraries, such as logging, allow users to pass Formatter objects.
This could be useful for controlling MontePy outputs. Attributes might be:
.mcnp_version = tuple (or .max_line_len = int); controls maximum line length
.importance_in_data_cards = bool
.volume_in_data_cards = bool
.universe_in_data_cards = bool
.compress_repeat_values = bool
.float_fmt = str (ex.: "{:9.6e}")
.line_wrap = enum; could be "&" or else an "indent" between 5 and some reasonable maximum.
.format_all_cards = bool; forces all cards to be mutated.
- etc.
The syntax could be either MCNP_Problem.formatter = Formatter(...) or MCNP_Problem.write_to_file(..., Formatter(...)). Basically, MontePy would internally pass around a Formatter instead of mcnp_version.
In GitLab by @tjlaboss on Aug 26, 2022, 13:02
Several Python libraries, such as
logging, allow users to passFormatterobjects.This could be useful for controlling MontePy outputs. Attributes might be:
.mcnp_version = tuple(or.max_line_len = int); controls maximum line length.importance_in_data_cards = bool.volume_in_data_cards = bool.universe_in_data_cards = bool.compress_repeat_values = bool.float_fmt = str(ex.: "{:9.6e}").line_wrap = enum; could be "&" or else an "indent" between 5 and some reasonable maximum..format_all_cards = bool; forces all cards to be mutated.The syntax could be either
MCNP_Problem.formatter = Formatter(...)orMCNP_Problem.write_to_file(..., Formatter(...)). Basically, MontePy would internally pass around aFormatterinstead ofmcnp_version.