Skip to content

Commit

Permalink
Add comment linking to ipython doc
Browse files Browse the repository at this point in the history
  • Loading branch information
cphyc committed Mar 29, 2021
1 parent 6a1cb47 commit 5693bb0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 2 additions & 0 deletions yt/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,8 @@ def __getitem__(self, key):
def __contains__(self, item):
return item in self.config_root

# Add support for IPython rich display
# see https://ipython.readthedocs.io/en/stable/config/integrating.html
def _repr_json_(self):
return self.config_root._repr_json_()

Expand Down
8 changes: 5 additions & 3 deletions yt/utilities/configuration_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,14 @@ def as_dict(self, callback=lambda child: child.value):
def __repr__(self):
return f"<Node {self.key}>"

def _repr_json_(self):
return self.as_dict()

def __contains__(self, item):
return item in self.children

# Add support for IPython rich display
# see https://ipython.readthedocs.io/en/stable/config/integrating.html
def _repr_json_(self):
return self.as_dict()


class ConfigLeaf:
def __init__(self, key, parent: ConfigNode, value, extra_data=None):
Expand Down

0 comments on commit 5693bb0

Please sign in to comment.