Skip to content

Conversation

@MicahGale
Copy link
Collaborator

@MicahGale MicahGale commented Mar 20, 2025

Pull Request Checklist for MontePy

Description

This is a quick fix for the case where is_reflecting=False did nothing on output. This is because the syntax tree was only updated iff is_reflecting ^ is_white_boundary is True. This was a quick fix by giving a final else.

You know in rust had I done something like:

match (self.is_reflecting, self.is_white_boundary) {
   (True, False) => ...,
   (False, True) => ...,
}

The compiler would have complained. (Ignore the fact it would have been happy with:

if self.is_reflecting {

else if self.is_white_boundary {

}

)

Update

  • this causes an issue with a continue line if you have four leading spaces: *1... becomes 1.... This is because even with never_pad the minimum value length of the node is passed to the string formatter. This was solved by:
  1. Avoiding value_length for never_pad
  2. fixing method where modifier node is retroactively created for +1 numbers where never_pad=False
  3. Giving never_pad argumentto_generate_default_node`

Fixes #709

Also before you look a few lines down in the code see #711.

General Checklist

  • I have performed a self-review of my own code.
  • The code follows the standards outlined in the development documentation.
  • I have formatted my code with black version 25.
  • I have added tests that prove my fix is effective or that my feature works (if applicable).

Documentation Checklist

  • I have documented all added classes and methods.
  • For infrastructure updates, I have updated the developer's guide.
  • For significant new features, I have added a section to the getting started guide.

First-Time Contributor Checklist

  • If this is your first contribution, add yourself to pyproject.toml if you wish to do so.

Additional Notes for Reviewers

Ensure that:

  • The submitted code is consistent with the merge checklist outlined here.
  • The PR covers all relevant aspects according to the development guidelines.
  • 100% coverage of the patch is achieved, or justification for a variance is given.

📚 Documentation preview 📚: https://montepy--710.org.readthedocs.build/en/710/

@MicahGale MicahGale linked an issue Mar 20, 2025 that may be closed by this pull request
@MicahGale MicahGale self-assigned this Mar 20, 2025
@MicahGale MicahGale added alpha testing Issues that came up during alpha testing bugs A deviation from expected behavior that does not reach the level of being reportable as an "Error". labels Mar 20, 2025
@MicahGale MicahGale added this to the M&C workshop milestone Mar 20, 2025
@MicahGale MicahGale changed the base branch from develop to alpha-test-dev March 20, 2025 02:51
@MicahGale MicahGale marked this pull request as ready for review March 20, 2025 03:10
@MicahGale
Copy link
Collaborator Author

The new output looks like 101 PZ -0.63. I don't like that new leading space, but it's not incorrect, so I'm thinking let's hold off for now.

@MicahGale MicahGale requested a review from tjlaboss March 20, 2025 03:40
@tjlaboss
Copy link
Collaborator

tjlaboss commented Mar 20, 2025

That sounds fine: it preserves the transformed surface card's alignment.

I will test a case where the line contains 4 leading space to verify that this doesn't incorrectly change it into a continuation line.

Copy link
Collaborator

@tjlaboss tjlaboss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As it turns out, disabling is_reflecting or is_white_boundary on a line with 4 leading spaces does give it a fifth.

@MicahGale
Copy link
Collaborator Author

As it turns out, disabling is_reflecting or is_white_boundary on a line with 4 leading spaces does give it a fifth.

So question do we:

  1. preserve formatting, but then handle edge case of too much padding?
  2. Just always shrink to the left?

the second seems a lot easier.

@tjlaboss
Copy link
Collaborator

Priority 1 (make it right) is higher than priority 4 (make it pretty). So do option 2, and if if it's ugly, turn that into a separate issue.

@MicahGale MicahGale requested a review from tjlaboss March 21, 2025 15:22
@MicahGale MicahGale merged commit 3bbb34f into alpha-test-dev Mar 22, 2025
26 checks passed
@MicahGale MicahGale deleted the 709-surfaces-cant-be-unset-from-is_reflecting branch March 22, 2025 03:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

alpha testing Issues that came up during alpha testing bugs A deviation from expected behavior that does not reach the level of being reportable as an "Error".

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Surfaces can't be unset from is_reflecting

2 participants