Repository navigation
Fixed how data block importances handle trailing comments. - #1049
Merged
Merged
Conversation
MicahGale
marked this pull request as ready for review
November 5, 2026 04:50
Share the data-block _real_tree with _particle_importances and delete the trailing comment from both, so the comment is no longer duplicated after the next input's leading comment is moved. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
MicahGale
force-pushed
the
imp_trail_comment
branch
from
November 5, 2026 14:38
34e23a5 to
f6e506c
Compare
MicahGale
marked this pull request as draft
November 5, 2026 15:41
Collaborator
Author
|
Coveralls: https://coveralls.io/jobs/191002258 |
MicahGale
marked this pull request as ready for review
November 5, 2026 17:01
tjlaboss
approved these changes
Nov 5, 2026
tjlaboss
left a comment
Collaborator
There was a problem hiding this comment.
Nice, closing out some old issues.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request Checklist for MontePy
Description
This fixes a bug with how
Importancehandles syntax trees while in the data block. This is one of the most complicatedCellModifierInputs.Importancestores multiple copies of its syntax trees in two dictionaries, because all importances of all particle types get stored by a single object, and then at export this is split back into multiple outputs as needed.The issue was that the trailing comments were pulled from
_real_tree, but were not being cleared from_real_tree. In updating this it was decided that it was better for_real_treeand_particle_importancesto be the same objects in the data block version. This is because the distinction is only necessary where the data is actually mutating; in the cell block. So, here it is safe for both to point to the same objects, and then ensure that_real_treehas its trailing comment cleared. Also another test had to be updated because it accidentally had duplicate comments baked into the expected output.Also this tackles the shortcut recompression bug, which was related, but not quite common-mode failure.
During the
_update_valuesprocess when two trees can be printed as the same one tree was used to replace both copies. This broke the pointers from one of the trees to itsValueNodes, which breaks shortcut recompression which relies onid. Rather than replacing one tree with the other this now simply updates both trees with the proper particle classifier data, then when formatting the logic automatically uses these particle lists to determine if the next tree needs to be printed.Fixes #1048.
Fixes #397.
General Checklist
blackversion 26.LLM Disclosure
Are you?
Were any large language models (LLM or "AI") used in to generate any of this code?
Documentation Checklist
.. versionchanged::or.. versionadded::directives.Infrastructure Changes
Significant features or Behavior changes
First-Time Contributor Checklist
pyproject.tomlif you wish to do so.Additional Notes for Reviewers
Ensure that:
📚 Documentation preview 📚: https://montepy--1049.org.readthedocs.build/en/1049/