Skip to content

Commit fe49cfa

Browse files
committed
Opt out of special functionality (more)
If validation is off, we now don’t change things to graph objects. If the user attempts to do certain things, a validation error will likely pop up. But the normal creation of plots and things shouldn’t cause issues.
1 parent bf3c687 commit fe49cfa

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

plotly/graph_objs/graph_objs.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333

3434
from plotly import exceptions
3535
from plotly import utils
36+
from plotly.session import get_session_plot_options
3637

3738
import copy
3839
import sys
@@ -67,6 +68,11 @@ class PlotlyList(list):
6768

6869
def __init__(self, *args):
6970
super(PlotlyList, self).__init__(*args)
71+
72+
if not get_session_plot_options().get('validate', True):
73+
warnings.warn('Validation off. Defaulting to plain lists/dicts.')
74+
return
75+
7076
if args and isinstance(args[0], dict):
7177
raise exceptions.PlotlyListEntryError(
7278
obj=self,
@@ -326,6 +332,11 @@ def __init__(self, *args, **kwargs):
326332
if issubclass(NAME_TO_CLASS[class_name], PlotlyTrace):
327333
if (class_name != 'PlotlyTrace') and (class_name != 'Trace'):
328334
self['type'] = NAME_TO_KEY[class_name]
335+
336+
if not get_session_plot_options().get('validate', True):
337+
warnings.warn('Validation off. Defaulting to plain lists/dicts.')
338+
return
339+
329340
self.validate()
330341
if self.__class__.__name__ == 'PlotlyDict':
331342
warnings.warn("\nThe PlotlyDict class is a base class of "

0 commit comments

Comments
 (0)