Skip to content

Commit b71ad8a

Browse files
authored
Merge pull request #25 from CU-ESIIL/codex/add-auto-unwrapping-display-for-pipe-class
Improve Pipe display in notebooks
2 parents 641ee0e + 0a12177 commit b71ad8a

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/cubedynamics/piping.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,19 @@ def unwrap(self) -> T:
2828

2929
return self.value
3030

31+
def __repr__(self) -> str:
32+
"""Return the repr of the wrapped value for plain-text displays."""
33+
34+
return repr(self.value)
35+
36+
def _repr_html_(self):
37+
"""Rich HTML representation for Jupyter notebooks."""
38+
39+
val = self.value
40+
if hasattr(val, "_repr_html_"):
41+
return val._repr_html_()
42+
return repr(val)
43+
3144
@property
3245
def v(self) -> T:
3346
"""Convenience alias for :pyattr:`value`."""

0 commit comments

Comments
 (0)