-
Notifications
You must be signed in to change notification settings - Fork 11
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
Fix suggestions deserialization #95
Conversation
WalkthroughThe recent updates introduce exception handling for reading suggestions in the Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
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.
Actionable comments posted: 1
Outside diff range and nitpick comments (2)
tests/io/test_slp.py (2)
Line range hint
57-57
: Replace type comparison withisinstance()
.- assert type(labels) == Labels + assert isinstance(labels, Labels)
Line range hint
188-188
: Replace type comparison withisinstance()
.- assert type(labels.video.backend) == ImageVideo + assert isinstance(labels.video.backend, ImageVideo)
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (3)
- sleap_io/io/slp.py (1 hunks)
- sleap_io/version.py (1 hunks)
- tests/io/test_slp.py (3 hunks)
Files skipped from review due to trivial changes (1)
- sleap_io/version.py
Additional Context Used
Ruff (13)
sleap_io/io/slp.py (3)
27-27:
sleap_io.io.utils.write_hdf5_dataset
imported but unused
28-28:
sleap_io.io.utils.write_hdf5_group
imported but unused
29-29:
sleap_io.io.utils.write_hdf5_attrs
imported but unusedtests/io/test_slp.py (10)
6-6:
sleap_io.Edge
imported but unused
9-9:
sleap_io.LabeledFrame
imported but unused
10-10:
sleap_io.Track
imported but unused
11-11:
sleap_io.Point
imported but unused
12-12:
sleap_io.PredictedPoint
imported but unused
25-25:
sleap_io.io.slp.serialize_skeletons
imported but unused
29-29: Redefinition of unused
read_instances
from line 22
29-29:
sleap_io.io.slp.read_instances
imported but unused
57-57: Do not compare types, use
isinstance()
188-188: Do not compare types, use
isinstance()
Additional comments not posted (3)
tests/io/test_slp.py (2)
33-34
: Ensure that the newly added functionsread_suggestions
andwrite_suggestions
are utilized appropriately in the tests.
245-259
: The new test functiontest_suggestions
effectively tests the functionality of reading and writing suggestions, including handling missing datasets. This is a crucial part of the PR's objective to handle files without suggestions data.sleap_io/io/slp.py (1)
200-204
: The addition of exception handling forKeyError
inread_suggestions
is a critical improvement. It ensures that the function returns an empty list if the suggestions dataset is not found, which aligns with the PR's objective to handle older SLP files without suggestions data.
@@ -12,6 +12,7 @@ | |||
PredictedPoint, | |||
PredictedInstance, | |||
Labels, | |||
SuggestionFrame, |
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.
Remove unused import SuggestionFrame
.
- SuggestionFrame,
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
SuggestionFrame, |
This fixes an issue where we fail to load SLP files if they don't contain suggestions data. This was the case for SLP files produced with
sleap-io<0.1.1
.Summary by CodeRabbit
Bug Fixes
Chores
Tests