1313from plotly ._validate import validate
1414from .optional_imports import get_module
1515
16- from _plotly_utils .basevalidators import (
17- CompoundValidator ,
18- CompoundArrayValidator ,
19- BaseDataValidator ,
20- BaseValidator ,
21- LiteralValidator ,
22- )
23- from . import animation
24- from .callbacks import Points , InputDeviceState
25- from plotly .utils import ElidedPrettyPrinter
26- from .validators import DataValidator , LayoutValidator , FramesValidator
27-
2816# Create Undefined sentinel value
2917# - Setting a property to None removes any existing value
3018# - Setting a property to Undefined leaves existing value unmodified
@@ -100,6 +88,8 @@ class is a subclass of both BaseFigure and widgets.DOMWidget.
10088 if a property in the specification of data, layout, or frames
10189 is invalid AND skip_invalid is False
10290 """
91+ from .validators import DataValidator , LayoutValidator , FramesValidator
92+
10393 super (BaseFigure , self ).__init__ ()
10494
10595 # Assign layout_plotly to layout
@@ -257,6 +247,8 @@ class is a subclass of both BaseFigure and widgets.DOMWidget.
257247
258248 # Animation property validators
259249 # -----------------------------
250+ from . import animation
251+
260252 self ._animation_duration_validator = animation .DurationValidator ()
261253 self ._animation_easing_validator = animation .EasingValidator ()
262254
@@ -764,6 +756,7 @@ def select_traces(self, selector=None, row=None, col=None, secondary_y=None):
764756 )
765757
766758 def _perform_select_traces (self , filter_by_subplot , grid_subplot_refs , selector ):
759+ from plotly .subplots import _get_subplot_ref_for_trace
767760
768761 for trace in self .data :
769762 # Filter by subplot
@@ -1795,6 +1788,8 @@ def append_trace(self, trace, row, col):
17951788 self .add_trace (trace = trace , row = row , col = col )
17961789
17971790 def _set_trace_grid_position (self , trace , row , col , secondary_y = False ):
1791+ from plotly .subplots import _set_trace_grid_reference
1792+
17981793 grid_ref = self ._validate_get_grid_ref ()
17991794 return _set_trace_grid_reference (
18001795 trace , self .layout , grid_ref , row , col , secondary_y
@@ -1850,6 +1845,8 @@ def get_subplot(self, row, col, secondary_y=False):
18501845 - xaxis: plotly.graph_objs.layout.XAxis instance for subplot
18511846 - yaxis: plotly.graph_objs.layout.YAxis instance for subplot
18521847 """
1848+ from plotly .subplots import _get_grid_subplot
1849+
18531850 return _get_grid_subplot (self , row , col , secondary_y )
18541851
18551852 # Child property operations
@@ -2847,6 +2844,10 @@ def _perform_update(plotly_obj, update_obj, overwrite=False):
28472844 :class:`BasePlotlyType`, ``update_obj`` should be a tuple or list
28482845 of dicts
28492846 """
2847+ from _plotly_utils .basevalidators import (
2848+ CompoundValidator ,
2849+ CompoundArrayValidator ,
2850+ )
28502851
28512852 if update_obj is None :
28522853 # Nothing to do
@@ -2960,6 +2961,10 @@ class BasePlotlyType(object):
29602961 # of relative path to new property (e.g. ('title', 'font')
29612962 _mapped_properties = {}
29622963
2964+ _parent_path_str = ""
2965+ _path_str = ""
2966+ _valid_props = set ()
2967+
29632968 def __init__ (self , plotly_name , ** kwargs ):
29642969 """
29652970 Construct a new BasePlotlyType
@@ -2986,10 +2991,6 @@ def __init__(self, plotly_name, **kwargs):
29862991
29872992 # Initialize properties
29882993 # ---------------------
2989- # ### _validators ###
2990- # A dict from property names to property validators
2991- self ._validators = {}
2992-
29932994 # ### _compound_props ###
29942995 # A dict from compound property names to compound objects
29952996 self ._compound_props = {}
@@ -3086,30 +3087,6 @@ def plotly_name(self):
30863087 """
30873088 return self ._plotly_name
30883089
3089- @property
3090- def _parent_path_str (self ):
3091- """
3092- dot-separated path string to this object's parent.
3093-
3094- Returns
3095- -------
3096- str
3097-
3098- Examples
3099- --------
3100-
3101- >>> import plotly.graph_objs as go
3102- >>> go.Layout()._parent_path_str
3103- ''
3104-
3105- >>> go.layout.XAxis()._parent_path_str
3106- 'layout'
3107-
3108- >>> go.layout.xaxis.rangeselector.Button()._parent_path_str
3109- 'layout.xaxis.rangeselector'
3110- """
3111- raise NotImplementedError
3112-
31133090 @property
31143091 def _prop_descriptions (self ):
31153092 """
@@ -3680,6 +3657,8 @@ def _build_repr_for_class(props, class_name, parent_path_str=None):
36803657 str
36813658 The representation string
36823659 """
3660+ from plotly .utils import ElidedPrettyPrinter
3661+
36833662 if parent_path_str :
36843663 class_name = parent_path_str + "." + class_name
36853664
@@ -3702,6 +3681,7 @@ def __repr__(self):
37023681 Customize object representation when displayed in the
37033682 terminal/notebook
37043683 """
3684+ from _plotly_utils .basevalidators import LiteralValidator
37053685
37063686 # Get all properties
37073687 props = self ._props if self ._props is not None else {}
@@ -4285,7 +4265,7 @@ def _vals_equal(v1, v2):
42854265 bool
42864266 True if v1 and v2 are equal, False otherwise
42874267 """
4288- np = get_module ("numpy" )
4268+ np = get_module ("numpy" , should_load = False )
42894269 if np is not None and (
42904270 isinstance (v1 , np .ndarray ) or isinstance (v2 , np .ndarray )
42914271 ):
0 commit comments