Skip to content

Idea: Formatter class #103

@MicahGale

Description

@MicahGale

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestAn issue that improves the user interface.prettification 🦋Priority 4. Make it pretty

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions