fix: parse multiply shortcuts in universe data cards#975
Open
chenlichao wants to merge 1 commit into
Open
Conversation
Collaborator
|
Please use the pull request template. AI contributions are allowed, but must be disclosed. |
Collaborator
|
|
afed6ea to
42db9b8
Compare
Collaborator
|
@chenlichao please expand your description to include things like:
For fixing the test failures:
|
42db9b8 to
388c356
Compare
Author
|
Thanks for the guidance. I rebased this onto current |
388c356 to
907a6d1
Compare
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
Fixes #500.
This PR fixes parsing for MCNP universe data cards that use multiply shortcuts, for example:
Bug being fixed: MontePy did not correctly preserve expanded integer identifiers when a universe data card used shortcut tokens such as
2M,5M,7M, or1M. Those values could fall back through the syntax tree as text-like values instead of the numeric values required by the universe parser.Cause:
NUM_MULTIPLYdata-card tokens were not being converted through the same numeric-shortcut path used by other parsed numeric values. WhenValueNodeinstances were later converted to integer identifiers, shortcut-expanded values were not consistently available.Fix: The parser now treats
NUM_MULTIPLYas a numeric shortcut token and preserves the expanded numeric shortcut result on the syntax node, so downstream integer conversion receives the correct value.Syntax rule impact: This keeps MCNP multiply shortcut handling local to numeric data-card syntax:
nMexpands according to the existing shortcut semantics, and the expanded values are used when constructing universe identifiers. The regression test covers the concrete issue input and verifies the resulting universe sequence.General Checklist
blackversion 25 or 26.LLM Disclosure
Are you?
Were any large language models (LLM or "AI") used in to generate any of this code?
Documentation Checklist
doc/source/changelog.rst.First-Time Contributor Checklist
pyproject.tomlif you wish to do so.Additional Notes for Reviewers
Ensure that:
Test Plan
.venv/bin/python -m pytest tests/test_universe.py -q— 40 passedcd doc && make html SPHINXOPTS='-W --keep-going -E'— build succeeded📚 Documentation preview 📚: https://montepy--975.org.readthedocs.build/en/975/
📚 Documentation preview 📚: https://montepy--975.org.readthedocs.build/en/975/