Skip to content

Commit

Permalink
perf(datasets): lazily load datasets in init files (plotly)
Browse files Browse the repository at this point in the history
Signed-off-by: Deepyaman Datta <deepyaman.datta@utexas.edu>
  • Loading branch information
deepyaman committed Jul 25, 2023
1 parent 21fb499 commit 587b2c2
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions kedro-datasets/kedro_datasets/plotly/__init__.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
"""``AbstractDataSet`` implementations to load/save a plotly figure from/to a JSON
file."""
from typing import Any

__all__ = ["PlotlyDataSet", "JSONDataSet"]
import lazy_loader as lazy

from contextlib import suppress
# https://github.com/pylint-dev/pylint/issues/4300#issuecomment-1043601901
JSONDataSet: Any
PlotlyDataSet: Any

with suppress(ImportError):
from .plotly_dataset import PlotlyDataSet
with suppress(ImportError):
from .json_dataset import JSONDataSet
__getattr__, __dir__, __all__ = lazy.attach(
__name__,
submod_attrs={"json_dataset": ["JSONDataSet"], "plotly_dataset": ["PlotlyDataSet"]},
)

0 comments on commit 587b2c2

Please sign in to comment.