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.
[MSD-359][feature] Renumber FM fiducials in multipoint window #3378
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
[MSD-359][feature] Renumber FM fiducials in multipoint window #3378
Changes from all commits
b28b778File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer catching a specific exception over bare
Exception.The static analysis tool flagged this catch-all. Since
targets.valueaccess typically raisesAttributeErroriftargetsisNoneor lacks thevalueattribute, catch that specifically. This avoids silently swallowing unexpected errors.Proposed fix
try: targets = self._tab_data_model.main.targets.value - except Exception: + except AttributeError: # If targets are not available for any reason, skip renumbering return📝 Committable suggestion
🧰 Tools
🪛 Ruff (0.15.2)
[warning] 857-857: Do not catch blind exception:
Exception(BLE001)
🤖 Prompt for AI Agents
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm missing why numbering isn't problematic when there are fib fiducials.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It can be deleted in pairs , if certain FIB-FM pair is not of interest to the user. Although the numbering of the indices are not continuous but the pairs would be in sync,
pairs of FM-FIB, 1-1, 2-2, 3-3, 6-6 (after deleting pair 4 and 5). The pair indices should be same.
Earlier, when there are 20 FM indices, user decides to delete 4 indices (3,4,5,6).
FM 1,2,.....7 upto 20. Then in FIB the user has to either make fake 4 FIBs between 2 and 7 and delete it afterwards, which is a bit of annoyance.
This is how renumbering helps.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we make our lives a bit hard with this. Why didn't we introduce a name and (computed) display_name (where we prepend prefix and append suffix on a callback) for instance.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is something for the technical debt board:
https://delmic.atlassian.net/jira/software/projects/SWM/boards/33?selectedIssue=SWM-222
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Guard against regex match returning
None.If a target's name doesn't contain the expected prefix pattern (no dash),
re.search()returnsNoneand.group()raisesAttributeError. Although FM fiducials should consistently have this format, defensive coding prevents unexpected crashes if data is malformed.Proposed fix
for new_idx, target in enumerate(fm_fiducials, start=1): old_name = target.name.value - old_name_type = re.search(FIDUCIAL_PATTERN, old_name).group() + match = re.search(FIDUCIAL_PATTERN, old_name) + if not match: + logging.warning(f"FM fiducial name '{old_name}' does not match expected pattern, skipping renumber") + continue + old_name_type = match.group() target.index.value = new_idx target.name.value = old_name_type + str(target.index.value)🤖 Prompt for AI Agents
Uh oh!
There was an error while loading. Please reload this page.