Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 31d9583

Browse files
committed
optional import of chart_studio in src validator
1 parent 315fce6 commit 31d9583

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

plotly-package/_plotly_utils/basevalidators.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -600,19 +600,21 @@ def __init__(self, plotly_name, parent_name, **kwargs):
600600
super(SrcValidator, self).__init__(
601601
plotly_name=plotly_name, parent_name=parent_name, **kwargs)
602602

603+
self.chart_studio = get_module('chart_studio')
604+
603605
def description(self):
604606
return ("""\
605607
The '{plotly_name}' property must be specified as a string or
606608
as a plotly.grid_objs.Column object""".format(plotly_name=self.plotly_name))
607609

608610
def validate_coerce(self, v):
609-
from chart_studio.grid_objs import Column
610611
if v is None:
611612
# Pass None through
612613
pass
613614
elif isinstance(v, string_types):
614615
pass
615-
elif isinstance(v, Column):
616+
elif self.chart_studio and \
617+
isinstance(v, self.chart_studio.grid_objs.Column):
616618
# Convert to id string
617619
v = v.id
618620
else:

0 commit comments

Comments
 (0)