|
1 | 1 | import sys
|
2 |
| -from _plotly_utils.importers import relative_import |
| 2 | +from typing import TYPE_CHECKING |
| 3 | +if sys.version_info < (3, 7) or TYPE_CHECKING: |
| 4 | + from ._bar import Bar |
| 5 | + from ._barpolar import Barpolar |
| 6 | + from ._box import Box |
| 7 | + from ._candlestick import Candlestick |
| 8 | + from ._carpet import Carpet |
| 9 | + from ._choropleth import Choropleth |
| 10 | + from ._choroplethmap import Choroplethmap |
| 11 | + from ._choroplethmapbox import Choroplethmapbox |
| 12 | + from ._cone import Cone |
| 13 | + from ._contour import Contour |
| 14 | + from ._contourcarpet import Contourcarpet |
| 15 | + from ._densitymap import Densitymap |
| 16 | + from ._densitymapbox import Densitymapbox |
| 17 | + from ._deprecations import AngularAxis |
| 18 | + from ._deprecations import Annotation |
| 19 | + from ._deprecations import Annotations |
| 20 | + from ._deprecations import ColorBar |
| 21 | + from ._deprecations import Contours |
| 22 | + from ._deprecations import Data |
| 23 | + from ._deprecations import ErrorX |
| 24 | + from ._deprecations import ErrorY |
| 25 | + from ._deprecations import ErrorZ |
| 26 | + from ._deprecations import Font |
| 27 | + from ._deprecations import Frames |
| 28 | + from ._deprecations import Histogram2dcontour |
| 29 | + from ._deprecations import Legend |
| 30 | + from ._deprecations import Line |
| 31 | + from ._deprecations import Margin |
| 32 | + from ._deprecations import Marker |
| 33 | + from ._deprecations import RadialAxis |
| 34 | + from ._deprecations import Scene |
| 35 | + from ._deprecations import Stream |
| 36 | + from ._deprecations import Trace |
| 37 | + from ._deprecations import XAxis |
| 38 | + from ._deprecations import XBins |
| 39 | + from ._deprecations import YAxis |
| 40 | + from ._deprecations import YBins |
| 41 | + from ._deprecations import ZAxis |
| 42 | + from ._figure import Figure |
| 43 | + from ._frame import Frame |
| 44 | + from ._funnel import Funnel |
| 45 | + from ._funnelarea import Funnelarea |
| 46 | + from ._heatmap import Heatmap |
| 47 | + from ._histogram import Histogram |
| 48 | + from ._histogram2d import Histogram2d |
| 49 | + from ._histogram2dcontour import Histogram2dContour |
| 50 | + from ._icicle import Icicle |
| 51 | + from ._image import Image |
| 52 | + from ._indicator import Indicator |
| 53 | + from ._isosurface import Isosurface |
| 54 | + from ._layout import Layout |
| 55 | + from ._mesh3d import Mesh3d |
| 56 | + from ._ohlc import Ohlc |
| 57 | + from ._parcats import Parcats |
| 58 | + from ._parcoords import Parcoords |
| 59 | + from ._pie import Pie |
| 60 | + from ._sankey import Sankey |
| 61 | + from ._scatter import Scatter |
| 62 | + from ._scatter3d import Scatter3d |
| 63 | + from ._scattercarpet import Scattercarpet |
| 64 | + from ._scattergeo import Scattergeo |
| 65 | + from ._scattergl import Scattergl |
| 66 | + from ._scattermap import Scattermap |
| 67 | + from ._scattermapbox import Scattermapbox |
| 68 | + from ._scatterpolar import Scatterpolar |
| 69 | + from ._scatterpolargl import Scatterpolargl |
| 70 | + from ._scattersmith import Scattersmith |
| 71 | + from ._scatterternary import Scatterternary |
| 72 | + from ._splom import Splom |
| 73 | + from ._streamtube import Streamtube |
| 74 | + from ._sunburst import Sunburst |
| 75 | + from ._surface import Surface |
| 76 | + from ._table import Table |
| 77 | + from ._treemap import Treemap |
| 78 | + from ._violin import Violin |
| 79 | + from ._volume import Volume |
| 80 | + from ._waterfall import Waterfall |
| 81 | + from . import bar |
| 82 | + from . import barpolar |
| 83 | + from . import box |
| 84 | + from . import candlestick |
| 85 | + from . import carpet |
| 86 | + from . import choropleth |
| 87 | + from . import choroplethmap |
| 88 | + from . import choroplethmapbox |
| 89 | + from . import cone |
| 90 | + from . import contour |
| 91 | + from . import contourcarpet |
| 92 | + from . import densitymap |
| 93 | + from . import densitymapbox |
| 94 | + from . import funnel |
| 95 | + from . import funnelarea |
| 96 | + from . import heatmap |
| 97 | + from . import histogram |
| 98 | + from . import histogram2d |
| 99 | + from . import histogram2dcontour |
| 100 | + from . import icicle |
| 101 | + from . import image |
| 102 | + from . import indicator |
| 103 | + from . import isosurface |
| 104 | + from . import layout |
| 105 | + from . import mesh3d |
| 106 | + from . import ohlc |
| 107 | + from . import parcats |
| 108 | + from . import parcoords |
| 109 | + from . import pie |
| 110 | + from . import sankey |
| 111 | + from . import scatter |
| 112 | + from . import scatter3d |
| 113 | + from . import scattercarpet |
| 114 | + from . import scattergeo |
| 115 | + from . import scattergl |
| 116 | + from . import scattermap |
| 117 | + from . import scattermapbox |
| 118 | + from . import scatterpolar |
| 119 | + from . import scatterpolargl |
| 120 | + from . import scattersmith |
| 121 | + from . import scatterternary |
| 122 | + from . import splom |
| 123 | + from . import streamtube |
| 124 | + from . import sunburst |
| 125 | + from . import surface |
| 126 | + from . import table |
| 127 | + from . import treemap |
| 128 | + from . import violin |
| 129 | + from . import volume |
| 130 | + from . import waterfall |
| 131 | +else: |
| 132 | + from _plotly_utils.importers import relative_import |
| 133 | + __all__, __getattr__, __dir__ = relative_import( |
| 134 | + __name__, |
| 135 | + ['.bar', '.barpolar', '.box', '.candlestick', '.carpet', '.choropleth', '.choroplethmap', '.choroplethmapbox', '.cone', '.contour', '.contourcarpet', '.densitymap', '.densitymapbox', '.funnel', '.funnelarea', '.heatmap', '.histogram', '.histogram2d', '.histogram2dcontour', '.icicle', '.image', '.indicator', '.isosurface', '.layout', '.mesh3d', '.ohlc', '.parcats', '.parcoords', '.pie', '.sankey', '.scatter', '.scatter3d', '.scattercarpet', '.scattergeo', '.scattergl', '.scattermap', '.scattermapbox', '.scatterpolar', '.scatterpolargl', '.scattersmith', '.scatterternary', '.splom', '.streamtube', '.sunburst', '.surface', '.table', '.treemap', '.violin', '.volume', '.waterfall'], |
| 136 | + ['._bar.Bar', '._barpolar.Barpolar', '._box.Box', '._candlestick.Candlestick', '._carpet.Carpet', '._choropleth.Choropleth', '._choroplethmap.Choroplethmap', '._choroplethmapbox.Choroplethmapbox', '._cone.Cone', '._contour.Contour', '._contourcarpet.Contourcarpet', '._densitymap.Densitymap', '._densitymapbox.Densitymapbox', '._deprecations.AngularAxis', '._deprecations.Annotation', '._deprecations.Annotations', '._deprecations.ColorBar', '._deprecations.Contours', '._deprecations.Data', '._deprecations.ErrorX', '._deprecations.ErrorY', '._deprecations.ErrorZ', '._deprecations.Font', '._deprecations.Frames', '._deprecations.Histogram2dcontour', '._deprecations.Legend', '._deprecations.Line', '._deprecations.Margin', '._deprecations.Marker', '._deprecations.RadialAxis', '._deprecations.Scene', '._deprecations.Stream', '._deprecations.Trace', '._deprecations.XAxis', '._deprecations.XBins', '._deprecations.YAxis', '._deprecations.YBins', '._deprecations.ZAxis', '._figure.Figure', '._frame.Frame', '._funnel.Funnel', '._funnelarea.Funnelarea', '._heatmap.Heatmap', '._histogram.Histogram', '._histogram2d.Histogram2d', '._histogram2dcontour.Histogram2dContour', '._icicle.Icicle', '._image.Image', '._indicator.Indicator', '._isosurface.Isosurface', '._layout.Layout', '._mesh3d.Mesh3d', '._ohlc.Ohlc', '._parcats.Parcats', '._parcoords.Parcoords', '._pie.Pie', '._sankey.Sankey', '._scatter.Scatter', '._scatter3d.Scatter3d', '._scattercarpet.Scattercarpet', '._scattergeo.Scattergeo', '._scattergl.Scattergl', '._scattermap.Scattermap', '._scattermapbox.Scattermapbox', '._scatterpolar.Scatterpolar', '._scatterpolargl.Scatterpolargl', '._scattersmith.Scattersmith', '._scatterternary.Scatterternary', '._splom.Splom', '._streamtube.Streamtube', '._sunburst.Sunburst', '._surface.Surface', '._table.Table', '._treemap.Treemap', '._violin.Violin', '._volume.Volume', '._waterfall.Waterfall'] |
| 137 | + ) |
3 | 138 |
|
4 |
| -__all__, __getattr__, __dir__ = relative_import( |
5 |
| - __name__, |
6 |
| - [ |
7 |
| - ".bar", |
8 |
| - ".barpolar", |
9 |
| - ".box", |
10 |
| - ".candlestick", |
11 |
| - ".carpet", |
12 |
| - ".choropleth", |
13 |
| - ".choroplethmap", |
14 |
| - ".choroplethmapbox", |
15 |
| - ".cone", |
16 |
| - ".contour", |
17 |
| - ".contourcarpet", |
18 |
| - ".densitymap", |
19 |
| - ".densitymapbox", |
20 |
| - ".funnel", |
21 |
| - ".funnelarea", |
22 |
| - ".heatmap", |
23 |
| - ".histogram", |
24 |
| - ".histogram2d", |
25 |
| - ".histogram2dcontour", |
26 |
| - ".icicle", |
27 |
| - ".image", |
28 |
| - ".indicator", |
29 |
| - ".isosurface", |
30 |
| - ".layout", |
31 |
| - ".mesh3d", |
32 |
| - ".ohlc", |
33 |
| - ".parcats", |
34 |
| - ".parcoords", |
35 |
| - ".pie", |
36 |
| - ".sankey", |
37 |
| - ".scatter", |
38 |
| - ".scatter3d", |
39 |
| - ".scattercarpet", |
40 |
| - ".scattergeo", |
41 |
| - ".scattergl", |
42 |
| - ".scattermap", |
43 |
| - ".scattermapbox", |
44 |
| - ".scatterpolar", |
45 |
| - ".scatterpolargl", |
46 |
| - ".scattersmith", |
47 |
| - ".scatterternary", |
48 |
| - ".splom", |
49 |
| - ".streamtube", |
50 |
| - ".sunburst", |
51 |
| - ".surface", |
52 |
| - ".table", |
53 |
| - ".treemap", |
54 |
| - ".violin", |
55 |
| - ".volume", |
56 |
| - ".waterfall", |
57 |
| - ], |
58 |
| - [ |
59 |
| - "._bar.Bar", |
60 |
| - "._barpolar.Barpolar", |
61 |
| - "._box.Box", |
62 |
| - "._candlestick.Candlestick", |
63 |
| - "._carpet.Carpet", |
64 |
| - "._choropleth.Choropleth", |
65 |
| - "._choroplethmap.Choroplethmap", |
66 |
| - "._choroplethmapbox.Choroplethmapbox", |
67 |
| - "._cone.Cone", |
68 |
| - "._contour.Contour", |
69 |
| - "._contourcarpet.Contourcarpet", |
70 |
| - "._densitymap.Densitymap", |
71 |
| - "._densitymapbox.Densitymapbox", |
72 |
| - "._deprecations.AngularAxis", |
73 |
| - "._deprecations.Annotation", |
74 |
| - "._deprecations.Annotations", |
75 |
| - "._deprecations.ColorBar", |
76 |
| - "._deprecations.Contours", |
77 |
| - "._deprecations.Data", |
78 |
| - "._deprecations.ErrorX", |
79 |
| - "._deprecations.ErrorY", |
80 |
| - "._deprecations.ErrorZ", |
81 |
| - "._deprecations.Font", |
82 |
| - "._deprecations.Frames", |
83 |
| - "._deprecations.Histogram2dcontour", |
84 |
| - "._deprecations.Legend", |
85 |
| - "._deprecations.Line", |
86 |
| - "._deprecations.Margin", |
87 |
| - "._deprecations.Marker", |
88 |
| - "._deprecations.RadialAxis", |
89 |
| - "._deprecations.Scene", |
90 |
| - "._deprecations.Stream", |
91 |
| - "._deprecations.Trace", |
92 |
| - "._deprecations.XAxis", |
93 |
| - "._deprecations.XBins", |
94 |
| - "._deprecations.YAxis", |
95 |
| - "._deprecations.YBins", |
96 |
| - "._deprecations.ZAxis", |
97 |
| - "._figure.Figure", |
98 |
| - "._frame.Frame", |
99 |
| - "._funnel.Funnel", |
100 |
| - "._funnelarea.Funnelarea", |
101 |
| - "._heatmap.Heatmap", |
102 |
| - "._histogram.Histogram", |
103 |
| - "._histogram2d.Histogram2d", |
104 |
| - "._histogram2dcontour.Histogram2dContour", |
105 |
| - "._icicle.Icicle", |
106 |
| - "._image.Image", |
107 |
| - "._indicator.Indicator", |
108 |
| - "._isosurface.Isosurface", |
109 |
| - "._layout.Layout", |
110 |
| - "._mesh3d.Mesh3d", |
111 |
| - "._ohlc.Ohlc", |
112 |
| - "._parcats.Parcats", |
113 |
| - "._parcoords.Parcoords", |
114 |
| - "._pie.Pie", |
115 |
| - "._sankey.Sankey", |
116 |
| - "._scatter.Scatter", |
117 |
| - "._scatter3d.Scatter3d", |
118 |
| - "._scattercarpet.Scattercarpet", |
119 |
| - "._scattergeo.Scattergeo", |
120 |
| - "._scattergl.Scattergl", |
121 |
| - "._scattermap.Scattermap", |
122 |
| - "._scattermapbox.Scattermapbox", |
123 |
| - "._scatterpolar.Scatterpolar", |
124 |
| - "._scatterpolargl.Scatterpolargl", |
125 |
| - "._scattersmith.Scattersmith", |
126 |
| - "._scatterternary.Scatterternary", |
127 |
| - "._splom.Splom", |
128 |
| - "._streamtube.Streamtube", |
129 |
| - "._sunburst.Sunburst", |
130 |
| - "._surface.Surface", |
131 |
| - "._table.Table", |
132 |
| - "._treemap.Treemap", |
133 |
| - "._violin.Violin", |
134 |
| - "._volume.Volume", |
135 |
| - "._waterfall.Waterfall", |
136 |
| - ], |
137 |
| -) |
138 |
| - |
139 |
| - |
140 |
| -__all__.append("FigureWidget") |
141 |
| -orig_getattr = __getattr__ |
142 |
| - |
143 |
| - |
144 |
| -def __getattr__(import_name): |
145 |
| - if import_name == "FigureWidget": |
146 |
| - try: |
147 |
| - import ipywidgets |
148 |
| - from packaging.version import Version |
149 |
| - |
150 |
| - if Version(ipywidgets.__version__) >= Version("7.0.0"): |
151 |
| - from ..graph_objs._figurewidget import FigureWidget |
152 | 139 |
|
| 140 | +if sys.version_info < (3, 7) or TYPE_CHECKING: |
| 141 | + try: |
| 142 | + import ipywidgets as _ipywidgets |
| 143 | + from packaging.version import Version as _Version |
| 144 | + if _Version(_ipywidgets.__version__) >= _Version("7.0.0"): |
| 145 | + from ..graph_objs._figurewidget import FigureWidget |
| 146 | + else: |
| 147 | + raise ImportError() |
| 148 | + except Exception: |
| 149 | + from ..missing_anywidget import FigureWidget |
| 150 | +else: |
| 151 | + __all__.append("FigureWidget") |
| 152 | + orig_getattr = __getattr__ |
| 153 | + def __getattr__(import_name): |
| 154 | + if import_name == "FigureWidget": |
| 155 | + try: |
| 156 | + import ipywidgets |
| 157 | + from packaging.version import Version |
| 158 | + if Version(ipywidgets.__version__) >= Version("7.0.0"): |
| 159 | + from ..graph_objs._figurewidget import FigureWidget |
| 160 | + return FigureWidget |
| 161 | + else: |
| 162 | + raise ImportError() |
| 163 | + except Exception: |
| 164 | + from ..missing_anywidget import FigureWidget |
153 | 165 | return FigureWidget
|
154 | 166 | else:
|
155 | 167 | raise ImportError()
|
156 |
| - except Exception: |
157 |
| - from ..missing_anywidget import FigureWidget |
158 | 168 |
|
159 |
| - return FigureWidget |
| 169 | + return orig_getattr(import_name) |
160 | 170 |
|
161 |
| - return orig_getattr(import_name) |
|
0 commit comments