-
Notifications
You must be signed in to change notification settings - Fork 25
HTML repr: Remove double nesting in processing modules #1354
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
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev #1354 +/- ##
==========================================
- Coverage 92.46% 92.44% -0.03%
==========================================
Files 42 42
Lines 9730 9742 +12
Branches 1975 1978 +3
==========================================
+ Hits 8997 9006 +9
- Misses 461 462 +1
- Partials 272 274 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
oruebel
left a comment
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.
Looks good to me
Co-authored-by: Oliver Ruebel <oruebel@users.noreply.github.com>
I understand that it's nice to have all the html code in one place, but I don't think it is such a bad thing to have HTML repr code in PyNWB. Each subclass should be able to control how it's displayed in HTML. We already have overrides for TimeSeries in PyNWB: https://github.com/NeurodataWithoutBorders/pynwb/blob/7e100c2d06ba73cd9ad873a7b1ee0a2d5156ce8a/src/pynwb/base.py#L352 In the approach of this PR, it might be confusing to maintainers who are wondering why there is a special case for PyNWB in HDMF, and this function could grow in complexity as more special cases get added. If someone builds an extension that happens to have a MultiContainerInterface with attribute name "data_interfaces", they may be confused as to why this behavior is different. These are rare cases though. I would prefer to have this in PyNWB. |
I am OK with it. The only downside is the slower cycle of release : ( |
|
Moved to pynwb here: Feel free to close this then. |
|
Now that I have tested this and the other PR locally, it would be nice to make this work for all MultiContainerInterface classes that have only one grouping attribute. These classes allow the user to get the child by name without knowing the attribute name, e.g., See Lines 1278 to 1282 in 35f123e
|
|
Great! Thank you so much @h-mayorquin ! |

This PR modifies the html repr of the NWBFiles so the processing modules do not display a double nesting with the data_interfaces attribute:
Left is the new behavior right is the old behavior
This uses duck typing in the MultiContainerinterface to eliminate the double nesting (right on the image above) for the
ProcessingModule. AsProcessingModulelives on pynwb I can't do the more natural solution of either overriding the method there (which would imply having some of the html repr code in pynwb) or checking of class instance here (which risks a circular dependency).Checklist
CHANGELOG.mdwith your changes?