13
13
from plotly ._validate import validate
14
14
from .optional_imports import get_module
15
15
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
-
28
16
# Create Undefined sentinel value
29
17
# - Setting a property to None removes any existing value
30
18
# - Setting a property to Undefined leaves existing value unmodified
@@ -100,6 +88,8 @@ class is a subclass of both BaseFigure and widgets.DOMWidget.
100
88
if a property in the specification of data, layout, or frames
101
89
is invalid AND skip_invalid is False
102
90
"""
91
+ from .validators import DataValidator , LayoutValidator , FramesValidator
92
+
103
93
super (BaseFigure , self ).__init__ ()
104
94
105
95
# Assign layout_plotly to layout
@@ -257,6 +247,8 @@ class is a subclass of both BaseFigure and widgets.DOMWidget.
257
247
258
248
# Animation property validators
259
249
# -----------------------------
250
+ from . import animation
251
+
260
252
self ._animation_duration_validator = animation .DurationValidator ()
261
253
self ._animation_easing_validator = animation .EasingValidator ()
262
254
@@ -764,6 +756,7 @@ def select_traces(self, selector=None, row=None, col=None, secondary_y=None):
764
756
)
765
757
766
758
def _perform_select_traces (self , filter_by_subplot , grid_subplot_refs , selector ):
759
+ from plotly .subplots import _get_subplot_ref_for_trace
767
760
768
761
for trace in self .data :
769
762
# Filter by subplot
@@ -1795,6 +1788,8 @@ def append_trace(self, trace, row, col):
1795
1788
self .add_trace (trace = trace , row = row , col = col )
1796
1789
1797
1790
def _set_trace_grid_position (self , trace , row , col , secondary_y = False ):
1791
+ from plotly .subplots import _set_trace_grid_reference
1792
+
1798
1793
grid_ref = self ._validate_get_grid_ref ()
1799
1794
return _set_trace_grid_reference (
1800
1795
trace , self .layout , grid_ref , row , col , secondary_y
@@ -1850,6 +1845,8 @@ def get_subplot(self, row, col, secondary_y=False):
1850
1845
- xaxis: plotly.graph_objs.layout.XAxis instance for subplot
1851
1846
- yaxis: plotly.graph_objs.layout.YAxis instance for subplot
1852
1847
"""
1848
+ from plotly .subplots import _get_grid_subplot
1849
+
1853
1850
return _get_grid_subplot (self , row , col , secondary_y )
1854
1851
1855
1852
# Child property operations
@@ -2847,6 +2844,10 @@ def _perform_update(plotly_obj, update_obj, overwrite=False):
2847
2844
:class:`BasePlotlyType`, ``update_obj`` should be a tuple or list
2848
2845
of dicts
2849
2846
"""
2847
+ from _plotly_utils .basevalidators import (
2848
+ CompoundValidator ,
2849
+ CompoundArrayValidator ,
2850
+ )
2850
2851
2851
2852
if update_obj is None :
2852
2853
# Nothing to do
@@ -2960,6 +2961,10 @@ class BasePlotlyType(object):
2960
2961
# of relative path to new property (e.g. ('title', 'font')
2961
2962
_mapped_properties = {}
2962
2963
2964
+ _parent_path_str = ""
2965
+ _path_str = ""
2966
+ _valid_props = set ()
2967
+
2963
2968
def __init__ (self , plotly_name , ** kwargs ):
2964
2969
"""
2965
2970
Construct a new BasePlotlyType
@@ -2986,10 +2991,6 @@ def __init__(self, plotly_name, **kwargs):
2986
2991
2987
2992
# Initialize properties
2988
2993
# ---------------------
2989
- # ### _validators ###
2990
- # A dict from property names to property validators
2991
- self ._validators = {}
2992
-
2993
2994
# ### _compound_props ###
2994
2995
# A dict from compound property names to compound objects
2995
2996
self ._compound_props = {}
@@ -3086,30 +3087,6 @@ def plotly_name(self):
3086
3087
"""
3087
3088
return self ._plotly_name
3088
3089
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
-
3113
3090
@property
3114
3091
def _prop_descriptions (self ):
3115
3092
"""
@@ -3680,6 +3657,8 @@ def _build_repr_for_class(props, class_name, parent_path_str=None):
3680
3657
str
3681
3658
The representation string
3682
3659
"""
3660
+ from plotly .utils import ElidedPrettyPrinter
3661
+
3683
3662
if parent_path_str :
3684
3663
class_name = parent_path_str + "." + class_name
3685
3664
@@ -3702,6 +3681,7 @@ def __repr__(self):
3702
3681
Customize object representation when displayed in the
3703
3682
terminal/notebook
3704
3683
"""
3684
+ from _plotly_utils .basevalidators import LiteralValidator
3705
3685
3706
3686
# Get all properties
3707
3687
props = self ._props if self ._props is not None else {}
@@ -4285,7 +4265,7 @@ def _vals_equal(v1, v2):
4285
4265
bool
4286
4266
True if v1 and v2 are equal, False otherwise
4287
4267
"""
4288
- np = get_module ("numpy" )
4268
+ np = get_module ("numpy" , should_load = False )
4289
4269
if np is not None and (
4290
4270
isinstance (v1 , np .ndarray ) or isinstance (v2 , np .ndarray )
4291
4271
):
0 commit comments