Skip to content

Commit 81f73d5

Browse files
committed
Remove unused clone
1 parent 1de750a commit 81f73d5

File tree

2 files changed

+10
-22
lines changed

2 files changed

+10
-22
lines changed

Diff for: packages/python/plotly/plotly/basedatatypes.py

+8-20
Original file line numberDiff line numberDiff line change
@@ -3273,7 +3273,7 @@ def _perform_batch_animate(self, animation_opts):
32733273

32743274
# Exports
32753275
# -------
3276-
def to_dict(self, clone=True):
3276+
def to_dict(self):
32773277
"""
32783278
Convert figure to a dictionary
32793279
@@ -3286,41 +3286,32 @@ def to_dict(self, clone=True):
32863286
"""
32873287
# Handle data
32883288
# -----------
3289-
if clone:
3290-
data = deepcopy(self._data)
3291-
else:
3292-
data = self._data
3289+
data = deepcopy(self._data)
32933290

32943291
# Handle layout
32953292
# -------------
3296-
if clone:
3297-
layout = deepcopy(self._layout)
3298-
else:
3299-
layout = self._layout
3293+
layout = deepcopy(self._layout)
33003294

33013295
# Handle frames
33023296
# -------------
33033297
# Frame key is only added if there are any frames
33043298
res = {"data": data, "layout": layout}
3305-
if clone:
3306-
frames = deepcopy([frame._props for frame in self._frame_objs])
3307-
else:
3308-
frames = [frame._props for frame in self._frame_objs]
3299+
frames = deepcopy([frame._props for frame in self._frame_objs])
33093300

33103301
if frames:
33113302
res["frames"] = frames
33123303

33133304
return res
33143305

3315-
def to_plotly_json(self, clone=True):
3306+
def to_plotly_json(self):
33163307
"""
33173308
Convert figure to a JSON representation as a Python dict
33183309
33193310
Returns
33203311
-------
33213312
dict
33223313
"""
3323-
return self.to_dict(clone=clone)
3314+
return self.to_dict()
33243315

33253316
@staticmethod
33263317
def _to_ordered_dict(d, skip_uid=False):
@@ -5550,18 +5541,15 @@ def on_change(self, callback, *args, **kwargs):
55505541
# -----------------
55515542
self._change_callbacks[arg_tuples].append(callback)
55525543

5553-
def to_plotly_json(self, clone=True):
5544+
def to_plotly_json(self):
55545545
"""
55555546
Return plotly JSON representation of object as a Python dict
55565547
55575548
Returns
55585549
-------
55595550
dict
55605551
"""
5561-
if clone:
5562-
return deepcopy(self._props if self._props is not None else {})
5563-
else:
5564-
return self._props if self._props is not None else {}
5552+
return deepcopy(self._props if self._props is not None else {})
55655553

55665554
@staticmethod
55675555
def _vals_equal(v1, v2):

Diff for: packages/python/plotly/plotly/io/_utils.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
import plotly.graph_objs as go
55

66

7-
def validate_coerce_fig_to_dict(fig, validate, clone=True):
7+
def validate_coerce_fig_to_dict(fig, validate):
88
from plotly.basedatatypes import BaseFigure
99

1010
if isinstance(fig, BaseFigure):
11-
fig_dict = fig.to_dict(clone=clone)
11+
fig_dict = fig.to_dict()
1212
elif isinstance(fig, dict):
1313
if validate:
1414
# This will raise an exception if fig is not a valid plotly figure

0 commit comments

Comments
 (0)