-
Notifications
You must be signed in to change notification settings - Fork 1
Do not error if the batch positions list is empty #631
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
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #631 +/- ##
==========================================
- Coverage 32.95% 32.93% -0.03%
==========================================
Files 90 90
Lines 11118 11125 +7
Branches 1465 1467 +2
==========================================
Hits 3664 3664
- Misses 7324 7331 +7
Partials 130 130 🚀 New features to boost your workflow:
|
| @@ -57,6 +57,9 @@ def post_transfer( | |||
|
|
|||
| windows_path = session_data["TomographySession"]["AtlasId"] | |||
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.
If we're referencing the keys "TomographySession" and "AtlasId" directly here, do we need logic to ensure KeyError exceptions are handled safely?
The other option is to do windows_path = session_data.get("TomographySession", {}).get("AtlasId", ""), which should exit safely in the if not windows_path: if-block down below.
| batch_positions_list = batch_xml["BatchPositionsList"]["BatchPositions"][ | ||
| "BatchPositionParameters" | ||
| ] | ||
| batch_positions_from_xml = batch_xml["BatchPositionsList"]["BatchPositions"] |
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.
Same principle here about safely handling KeyError exceptions.
tieneupin
left a comment
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.
Some suggestions for safely handling potential KeyErrors when calling values fro mthe dictionaries.
Very minor change. Currently the post transfer function gets an error when the batch positions list contains no positions, which this fixes.