Skip to content

Commit 7ad2a2a

Browse files
committed
Fix __repr__ for Frame objects
1 parent fa659c4 commit 7ad2a2a

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

plotly/basedatatypes.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3846,3 +3846,43 @@ def _send_prop_set(self, prop_path_str, val):
38463846
def on_change(self, callback, *args):
38473847
raise NotImplementedError(
38483848
'Change callbacks are not supported on Frames')
3849+
3850+
def _get_child_props(self, child):
3851+
"""
3852+
Return the properties dict for a child trace or child layout
3853+
3854+
Note: this method must match the name/signature of one on
3855+
BasePlotlyType
3856+
3857+
Parameters
3858+
----------
3859+
child : BaseTraceType | BaseLayoutType
3860+
3861+
Returns
3862+
-------
3863+
dict
3864+
"""
3865+
# Try to find index of child as a trace
3866+
# -------------------------------------
3867+
try:
3868+
trace_index = BaseFigure._index_is(self.data, child)
3869+
except ValueError as _:
3870+
trace_index = None
3871+
3872+
# Child is a trace
3873+
# ----------------
3874+
if trace_index is not None:
3875+
if 'data' in self._props:
3876+
return self._props['data'][trace_index]
3877+
else:
3878+
return None
3879+
3880+
# Child is the layout
3881+
# -------------------
3882+
elif child is self.layout:
3883+
return self._props.get('layout', None)
3884+
3885+
# Unknown child
3886+
# -------------
3887+
else:
3888+
raise ValueError('Unrecognized child: %s' % child)

0 commit comments

Comments
 (0)