feat(data): add __repr__ and describe() to OTXDataset for better debug#5849
Conversation
|
Please, update the branch with latest develop. Your changes can be merged |
3ecca06 to
96cadf9
Compare
There was a problem hiding this comment.
Pull request overview
Adds lightweight introspection utilities to the OTXDataset base class to make debugging and interactive inspection more informative.
Changes:
- Implement
OTXDataset.__repr__to show class name, sample count, and class count. - Add
OTXDataset.describe()to return a metadata dictionary for programmatic inspection. - Add unit tests covering the new
__repr__/describe()behavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
library/src/getitune/data/dataset/base.py |
Adds __repr__ and describe() to OTXDataset. |
library/tests/unit/data/dataset/test_base.py |
Adds unit tests validating __repr__ and describe() output. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Hi @kprokofi, thanks for the review. I have rebased the branch onto the latest develop and updated the PR base accordingly. Given that the file moved from lib/src/otx/ to library/src/getitune/ during the refactor, I re-applied the change at the new path and ported the tests to match the new test style. I have also updated the PR description. Let me know if anything else is needed! |
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
96cadf9 to
fb63854
Compare
|
Just renamed from OTXDataset to VisionDataset, tests passed locally. |
0cbc5a4
Summary
Add
__repr__anddescribe()methods to theOTXDatasetbase class for improved debuggability.Currently, printing an
OTXDatasetinstance shows an unhelpful default like<OTXDetectionDataset object at 0x7f...>. This PR adds:__repr__: Returns a concise summary string, e.g.VisionDataset(num_samples=100, num_classes=5). Usestype(self).__name__so subclasses automatically display the correct class name without needing to override.describe(): Returns a dictionary with dataset metadata (class_name,num_samples,num_classes,label_names,has_transforms), useful for programmatic introspection during development and debugging.Both methods are O(1) and rely on existing attributes (
label_info,dm_subset,transforms).How to test
All tests pass (12 pre-existing + 5 new).