Skip to content

Fix 5186 type checking renegerate code #5199

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 27, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Prev Previous commit
feat: reformatting code with black
  • Loading branch information
gvwilson committed May 27, 2025
commit 2611205e705bf07cd5d838e587f5fe6273f7761c
141 changes: 138 additions & 3 deletions plotly/graph_objs/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import sys
from typing import TYPE_CHECKING

if TYPE_CHECKING:
from ._bar import Bar
from ._barpolar import Barpolar
Expand Down Expand Up @@ -130,17 +131,148 @@
from . import waterfall
else:
from _plotly_utils.importers import relative_import

__all__, __getattr__, __dir__ = relative_import(
__name__,
['.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'],
['._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']
[
".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",
],
[
"._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",
],
)


if sys.version_info < (3, 7) or TYPE_CHECKING:
try:
import ipywidgets as _ipywidgets
from packaging.version import Version as _Version

if _Version(_ipywidgets.__version__) >= _Version("7.0.0"):
from ..graph_objs._figurewidget import FigureWidget
else:
Expand All @@ -150,21 +282,24 @@
else:
__all__.append("FigureWidget")
orig_getattr = __getattr__

def __getattr__(import_name):
if import_name == "FigureWidget":
try:
import ipywidgets
from packaging.version import Version

if Version(ipywidgets.__version__) >= Version("7.0.0"):
from ..graph_objs._figurewidget import FigureWidget

return FigureWidget
else:
raise ImportError()
except Exception:
from ..missing_anywidget import FigureWidget

return FigureWidget
else:
raise ImportError()

return orig_getattr(import_name)

Loading