Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR makes a small adjustment to assert_affine()’s error-printing logic in the NIfTI/POI abstraction layer, avoiding mutation of the text parameter while logging mismatches.
Changes:
- Stop reassigning
textinside thefound_errorsloop by introducing a separate per-error message variable. - Log each mismatch using the newly constructed message string.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+308
to
+309
| text2 = f"{text}; {err}" if text else f"{err}" | ||
| log.print(f"{text2}", ltype=Log_Type.FAIL, verbose=verbose) |
There was a problem hiding this comment.
text2 is a non-descriptive name for the constructed log message; consider renaming to something like msg/log_msg to make intent clear and avoid confusion with the text parameter used later in the AssertionError.
Suggested change
| text2 = f"{text}; {err}" if text else f"{err}" | |
| log.print(f"{text2}", ltype=Log_Type.FAIL, verbose=verbose) | |
| log_msg = f"{text}; {err}" if text else f"{err}" | |
| log.print(log_msg, ltype=Log_Type.FAIL, verbose=verbose) |
| text = f"{text}; {err}" if text else f"{err}" | ||
| log.print(f"{text}", ltype=Log_Type.FAIL, verbose=verbose) | ||
| text2 = f"{text}; {err}" if text else f"{err}" | ||
| log.print(f"{text2}", ltype=Log_Type.FAIL, verbose=verbose) |
There was a problem hiding this comment.
log.print(f"{text2}", ...) wraps an existing string in an f-string without interpolation; pass text2 directly to avoid redundant formatting.
Suggested change
| log.print(f"{text2}", ltype=Log_Type.FAIL, verbose=verbose) | |
| log.print(text2, ltype=Log_Type.FAIL, verbose=verbose) |
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.
No description provided.