idaholab / MontePy

MontePy is the most user friendly Python library (API) to read, edit, and write MCNP input files.
https://www.montepy.org/
MIT License
30 stars 6 forks source link

MontePy adds unnecessary blank lines at the end of a file #523

Open tjlaboss opened 3 weeks ago

tjlaboss commented 3 weeks ago

Is your feature request related to a problem? Please describe. When writing out a file, MontePy adds 2 unnecessary blank line delimiters.

Describe the solution you'd like Do not add newlines that are not present in the original file.

Describe alternatives you've considered Always rstrip("\n"), but that would get rid of any that the user included and may want to keep.

Additional context

This is trivial, and mildly annoying at worst. If MontePy supports writing sections of the Cell, Surface, and Data blocks to other files for use with read file=..., however, it could introduce bugs.

The only other use case I can imagine where this would be relevant is if a user writes to a stream and then manually writes additional data cards after MontePy is done.

MicahGale commented 3 weeks ago

So at the very end of the file?

tjlaboss commented 3 weeks ago

Yes. This is very low priority.

MicahGale commented 3 weeks ago

Ok the phrasing was ambiguous, and wanted to clarify.