Repository navigation
Conversation
getmatrix() raised TypeError for a nested list or tuple, such as a 2xN path written as [[0, 1, 2], [0, 1, 0]], and getvector() raised TypeError for a range. Convert a nested sequence to an array and check its shape like any 2D array, and treat a range like a list. A flat list is still reshaped as before. Refs rai-opensource#255
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #255.
getmatrix()raisedTypeErrorfor a nested list or tuple, such as a 2xN path written as[[0, 1, 2], [0, 1, 0]], andgetvector()raisedTypeErrorfor arange.getmatrix: a list or tuple that isn't a vector is converted withnp.arrayand then goes through the existing 2D branch, so its shape is checked againstshape(a mismatch raisesValueError; it isn't reshaped). Arangeis treated as a 1D sequence.getvector: arangeis converted to a list first, so everyoutformat works.Not changed: a flat list is still reshaped (
getmatrix([0, 1, 2, 3], (2, None))is still(2, 2)), andPoints2/Points3are untouched. Both change public behaviour, so I've left them for a separate decision.Behaviour change: inputs that used to raise
TypeErrorare now accepted; nothing that previously worked returns a different result.Tests: new cases in
tests/base/test_argcheck.pyfor nested lists/tuples (including shape mismatch) andrangeingetvector. Both fail on master and pass with the fix. Full suite: 475 passed, 3 skipped (master: 473 passed, 3 skipped). black and flake8 are clean on the changed files.AI disclosure: I used an AI assistant while working on this; I've read the diff and run the tests myself.