Skip to content

Commit 76d3ba2

Browse files
committed
Maintain backwards compat, but throw a warning.
1 parent 8b95a0b commit 76d3ba2

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

plotly/tools.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1413,3 +1413,43 @@ def return_figure_from_figure_or_data(figure_or_data, validate_figure):
14131413
)
14141414

14151415
return figure
1416+
1417+
FIGURE_FACTORY_DEPRECATION_WARNING = (
1418+
'DeprecationWarning: Oops, FigureFactory has been moved! Please import it '
1419+
'as follows:\n'
1420+
'`from plotly.graph_objs.figure_factory import FigureFactory`'
1421+
)
1422+
1423+
1424+
# Define this to raise a deprecation warning. Functionality has moved!
1425+
class FigureFactory(object):
1426+
1427+
@staticmethod
1428+
def create_quiver(*args, **kwargs):
1429+
warnings.warn(FIGURE_FACTORY_DEPRECATION_WARNING)
1430+
from plotly.graph_objs.figure_factory import FigureFactory as FF
1431+
return FF.create_quiver(*args, **kwargs)
1432+
1433+
@staticmethod
1434+
def create_streamline(*args, **kwargs):
1435+
warnings.warn(FIGURE_FACTORY_DEPRECATION_WARNING)
1436+
from plotly.graph_objs.figure_factory import FigureFactory as FF
1437+
return FF.create_streamline(*args, **kwargs)
1438+
1439+
@staticmethod
1440+
def create_candlestick(*args, **kwargs):
1441+
warnings.warn(FIGURE_FACTORY_DEPRECATION_WARNING)
1442+
from plotly.graph_objs.figure_factory import FigureFactory as FF
1443+
return FF.create_candlestick(*args, **kwargs)
1444+
1445+
@staticmethod
1446+
def create_distplot(*args, **kwargs):
1447+
warnings.warn(FIGURE_FACTORY_DEPRECATION_WARNING)
1448+
from plotly.graph_objs.figure_factory import FigureFactory as FF
1449+
return FF.create_distplot(*args, **kwargs)
1450+
1451+
@staticmethod
1452+
def create_dendrogram(*args, **kwargs):
1453+
warnings.warn(FIGURE_FACTORY_DEPRECATION_WARNING)
1454+
from plotly.graph_objs.figure_factory import FigureFactory as FF
1455+
return FF.create_dendrogram(*args, **kwargs)

0 commit comments

Comments
 (0)