Skip to content
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

Update Datatree html repr to indicate inheritance #9633

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

TomNicholas
Copy link
Member

@TomNicholas TomNicholas commented Oct 16, 2024

The HTML version of #9470. Haven't written any tests yet, but in this notebook it looks like it works.

@TomNicholas TomNicholas added topic-html-repr topic-DataTree Related to the implementation of a DataTree class labels Oct 16, 2024
@TomNicholas TomNicholas marked this pull request as ready for review October 16, 2024 14:11
shoyer
shoyer approved these changes Oct 16, 2024
)


def datatree_node_repr(group_title: str, node: DataTree, show_inherited=False) -> str:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume this logic now basically matches that in datatree_repr?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's the idea yes

Comment on lines +336 to +339
# TODO how can we assert that the Inherited coordinates section does not appear in the child group?
# with xr.set_options(display_style="html"):
# child_html = dt["a"]._repr_html_().strip()
# assert "Inherited coordinates" not in child_html
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not really sure how to test this any better. Both the correct and incorrect behaviour would give "Inherited coordinates" present somewhere in the long html repr text output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic-DataTree Related to the implementation of a DataTree class topic-html-repr
Projects
Status: In progress
Development

Successfully merging this pull request may close these issues.

2 participants