-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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 slices handling in LazyList #8299
Conversation
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughThe changes enhance the functionality of the Changes
Poem
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 Configuration 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: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- cvat/apps/engine/lazy_list.py (3 hunks)
- cvat/apps/engine/tests/test_lazy_list.py (2 hunks)
Additional comments not posted (7)
cvat/apps/engine/tests/test_lazy_list.py (5)
14-14
: Initialization with empty values is appropriate.The
setUp
method now initializesLazyList
with a string containing empty values, which is suitable for testing edge cases.
22-24
: Representation tests are accurate.The
test_repr
method correctly verifies the representation ofLazyList
, accounting for both parsed and unparsed elements.
168-168
: String conversion tests are accurate.The
test_str
method correctly verifies the string conversion ofLazyList
, ensuring it handles both parsed and unparsed states.
176-185
: Slicing tests are comprehensive.The
test_slice
method effectively covers various slicing scenarios, including negative indices, ensuring correct behavior ofLazyList
.
187-191
: Stride slicing tests are comprehensive.The
test_slice_with_stride
method effectively covers slicing with various strides, ensuring correct behavior ofLazyList
.cvat/apps/engine/lazy_list.py (2)
149-163
: Enhanced handling of negative indices is robust.The
__getitem__
method now correctly handles negative indices by parsing the entire list when necessary, improving robustness.
Line range hint
211-221
: Improved clarity and performance in_iter_unparsed
.The use of
probable_length
in_iter_unparsed
reduces redundant calls and enhances readability and performance.
Could you also update test assets or bracket handling in serialization into DB? I can see there are changes in array representations - the brackets are removed.
|
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 suggest that the PR is renamed, as the problem is not directly related to the CVAT format
- Please update changelog
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #8299 +/- ##
===========================================
- Coverage 83.36% 83.35% -0.02%
===========================================
Files 390 390
Lines 41498 41501 +3
Branches 3839 3839
===========================================
- Hits 34596 34593 -3
- Misses 6902 6908 +6
|
Quality Gate passedIssues Measures |
Motivation and context
Following v2.16.2 release, we noticed an issue with annotations export with CVAT format and masks.
Upon investigation, we found that the problem stemmed from changes introduced in this PR: #8229.
The issue was caused by the improper handling of slices with negative positions in LazyList, particularly affecting the computation of resulting data. This behaviour was triggered by the following line:
cvat/cvat/apps/dataset_manager/formats/cvat.py
Line 797 in cfce7be
How has this been tested?
Checklist
develop
branch(cvat-canvas,
cvat-core,
cvat-data and
cvat-ui)
License
Feel free to contact the maintainers if that's a concern.
Summary by CodeRabbit
New Features
Bug Fixes