Fix selection slice from integer#784
Conversation
Signed-off-by: Lukasz Wawrzyniak <lwawrzyniak@nvidia.com>
📝 WalkthroughWalkthroughUpdated ArticulationView._get_attribute_array in newton/_src/utils/selection.py to normalize integer _slice inputs into a one-element Python slice. Existing handling for None (frequency-based) and Slice inputs is unchanged. Non-int, non-slice inputs continue to raise TypeError. No public API signatures were modified. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests
Tip 👮 Agentic pre-merge checks are now available in preview!Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.
Please see the documentation for more information. Example: reviews:
pre_merge_checks:
custom_checks:
- name: "Undocumented Breaking Changes"
mode: "warning"
instructions: |
Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).Please share your feedback with us on this Discord post. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
newton/_src/utils/selection.py (1)
548-559: Align type hints with accepted _slice types._signatures accept int in practice; annotations still say slice. Update for accuracy and better static checking.
Apply this diff:
- def _get_attribute_values(self, name: str, source: Model | State | Control, _slice: slice | None = None): + def _get_attribute_values(self, name: str, source: Model | State | Control, _slice: Slice | int | None = None): @@ - self, name: str, target: Model | State | Control, values, mask=None, _slice: slice | None = None + self, name: str, target: Model | State | Control, values, mask=None, _slice: Slice | int | None = None
📜 Review details
Configuration used: Path: .coderabbit.yml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
newton/_src/utils/selection.py(1 hunks)
⏰ Context from checks skipped due to timeout of 900000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: Run GPU Unit Tests on AWS EC2 (Pull Request)
- GitHub Check: Run GPU Benchmarks (Pull Request)
- GitHub Check: run-newton-tests / newton-unittests (windows-latest)
- GitHub Check: run-newton-tests / newton-unittests (ubuntu-latest)
Signed-off-by: Lukasz Wawrzyniak <lwawrzyniak@nvidia.com>
Signed-off-by: Lukasz Wawrzyniak <lwawrzyniak@nvidia.com>
Fix
ArticulationView.get_root_transforms()raising this error with fixed-base articulations:Newton Migration Guide
Please ensure the migration guide for warp.sim users is up-to-date with the changes made in this PR.
docs/migration.rstis up-to dateBefore your PR is "Ready for review"
newton/tests/test_examples.py)pre-commit run -aSummary by CodeRabbit