fix: ArrayBuilder.show() formatter forwarding#3796
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files
🚀 New features to boost your workflow:
|
|
The documentation preview is ready to be viewed at http://preview.awkward-array.org.s3-website.us-east-1.amazonaws.com/PR3796 |
ArrayBuilder.show() formatter forwarding
There was a problem hiding this comment.
Thanks @X0708a for this!
This looks like the right fix and it is apparently something that was just forgotten in #3348
Could you also introduce the other arguments that #3348 introduced to show()? See the changes that this PR made and what Array.show() accepts:
awkward/src/awkward/highlevel.py
Lines 1401 to 1414 in c6fc079
Since
snapshot() returns an ak.Array, you can forward all of them to the .snapshot().show(...) call.
I have one comment regarding moving the test in the tests directory and I would also like you to add a bit more testing in the test. Test at least for example the few builder structures that we have in its docstring: https://awkward-array.org/doc/main/reference/generated/ak.ArrayBuilder.html. If you search for ".show()" in your browser in this page, you will see that we do .show() for a few builder types. Just test those in your test.
e0d488b to
8cb253c
Compare
|
Thanks for the review! |
|
Hi @X0708a, thanks for the changes! I would like to ask you to do a few more things:
I'd recommend git pulling first before pushing instead of force-pushing to grab the changes from the pre-commit ci hook btw. |
6c38511 to
84db75d
Compare
|
Thanks for the detailed feedback. |
ianna
left a comment
There was a problem hiding this comment.
@X0708a - This looks great! Thank you. Just a minor comment - please, move the tests from test_2055*.py to test_3724*.py Thanks!
49acf67 to
2adee49
Compare
ikrommyd
left a comment
There was a problem hiding this comment.
Other than the docstring style change that needs to be consistent with the rest and our docs, this looks good to me!
89df521 to
0bb93d2
Compare
|
Updated the docstring to match the project’s Args-style documentation and removed the extra blank line under the docstring. |
|
I have just pushed a minor docstring change to make it match exactly with the other two show docstrings and merged main on the feature branch. Should be perfect now. |
|
@all-contributors please add @X0708a for code |
|
I've put up a pull request to add @X0708a! 🎉 |
ArrayBuilder.show() formatter forwardingArrayBuilder.show() formatter forwarding
ianna
left a comment
There was a problem hiding this comment.
@X0708a - Thank you for your contribution! This looks great: all tests pass and the PR is ready to be merged. Thanks!
ArrayBuilder.show is documented to forward arguments unchanged to
snapshot().show, but currently wraps the formatter argument in a
Formatter instance. This causes Array.show to receive a non-mapping
formatter and raises a TypeError.
This change forwards formatter unchanged and adds a regression test
ensuring ArrayBuilder.show behaves identically to snapshot().show.
Fixes #3724