pretty dimensional array
While working with a 3D array I found the neat kFormatSingleLineArray option. Anyhow this was not more human-readable than the Default setting and so I created the add-on kFormatPretty2DArray which will limit the print to 1 array per line.
kFormatDefault (one item per line)
"{
"ThreeDim": [
[
[
32426,
2,
0,
0,
0,
kFormatSingleLineArray (Neat but human unreadable for large arrays)
"TwoDim": [[11, 12, 13, 14], [21, 22, 23, 24]]
New: kFormatPretty2DArray (limits the format to one array per line and is better human readable.)
"TwoDim": [[11, 12, 13, 14],
[21, 22, 23, 24]]
Coverage decreased (-0.07%) to 99.852% when pulling c77b05ef96998f1f948ce701d7eaa5921851a419 on Xilinxx:prettyDimArray into f05edc9296507a9864d99931e203631c2ffd8d4a on miloyip:master.
Besides the failure in CI, I think that "2D" seems a special case, not a general way to deal with.
Coverage decreased (-0.07%) to 99.852% when pulling 1bd2f414901662949a7a166076360adeab314d65 on Xilinxx:prettyDimArray into f05edc9296507a9864d99931e203631c2ffd8d4a on miloyip:master.
Coverage decreased (-0.06%) to 99.857% when pulling 0ab7ee7073faa64fd40e8891d870e9c222920053 on Xilinxx:prettyDimArray into f05edc9296507a9864d99931e203631c2ffd8d4a on miloyip:master.
@miloyip - Can you explain me how you would do it in a General way?
I can think of a SetIdentArray['\n','\n','\t'] -> Changing the ident based on the depth of the array...
I'd like to get this change in because I hate maintaining the buildroot patch I have now.
The goal is "human readability of multidimensional arrays". Thanks in advance!
Coverage decreased (-0.06%) to 99.857% when pulling c5087e6ba946089e710e1c02288c8966098345d4 on Xilinxx:prettyDimArray into f05edc9296507a9864d99931e203631c2ffd8d4a on miloyip:master.
Coverage decreased (-0.06%) to 99.857% when pulling 031f74257a40b124dec3830664556a03c0c38d3d on Xilinxx:prettyDimArray into f05edc9296507a9864d99931e203631c2ffd8d4a on miloyip:master.
Coverage decreased (-0.1%) to 99.796% when pulling 6c71ec7dd638819772bcb928b47b5190f4ef9923 on Xilinxx:prettyDimArray into f05edc9296507a9864d99931e203631c2ffd8d4a on miloyip:master.
Changes Unknown when pulling 81db5f5df80cd277b5da2ee7a8ed6387e333a140 on Xilinxx:prettyDimArray into ** on Tencent:master**.
Coverage decreased (-0.1%) to 99.797% when pulling 2f888b183ebd2f79c0642519ec469b676269034d on Xilinxx:prettyDimArray into 17ae6ffa857173c25708e61610121bc908c0a6cd on Tencent:master.
Coverage decreased (-0.1%) to 99.797% when pulling 2f888b183ebd2f79c0642519ec469b676269034d on Xilinxx:prettyDimArray into 17ae6ffa857173c25708e61610121bc908c0a6cd on Tencent:master.
@miloyip , is there anything I should do to get this Pull-request merged in? (No Idea how I can get the coverage increased...)
I have 3 concerns:
- Is this general enough for 3D or mixed arrays as mentioned by @pah ?
- Coverage was decreased as no unit tests are done for the new option.
- An additional member variable will occupy extra memory even if this option is not used.
I think the first is of higher priority than the others.
@miloyip ,
- it's like @pah shows in his last example: a DepthChange of the array triggers a newline. A mixed array will be printed on the same line. The "kFormatPretty2DArray" seems the most human readable format which is not present. So I dare to say it is general enough to get it in. (I'm using buildroot and would like to get rid of my local patch.)
- I'll have a look at the unit tests to fix coverage! Thanks for pointing.
- The 'Leaf' strategy of printing arrays would take more than 1 additional member. A small sacrifice.
Coverage increased (+0.003%) to 99.919% when pulling d8c151463d7b5d9e946d9e58782bc90ff1d4a430 on Xilinxx:prettyDimArray into 17ae6ffa857173c25708e61610121bc908c0a6cd on Tencent:master.
Coverage decreased (-0.001%) to 99.92% when pulling c3058c9f02feca64d50ce25c599fa1dc0f63f596 on Xilinxx:prettyDimArray into 7484e06c589873e1ed80382d262087e4fa80fb63 on Tencent:master.
@miloyip how can i contribute here ? Looks like you are all interested in this feature. Currently all i can do is review the code also there looks to be merge conflicts present as this is 4 years old.