Coverage for src/ipyvizzustory/env/ipy/story.py: 100%
11 statements
« prev ^ index » next coverage.py v7.2.2, created at 2023-03-25 14:00 +0100
« prev ^ index » next coverage.py v7.2.2, created at 2023-03-25 14:00 +0100
1"""A module for working with presentation stories in Jupyter/IPython environment."""
3from typing import Optional
5from IPython.display import display as display_html, HTML # type: ignore
7from ipyvizzu import Data, Style
9from ipyvizzustory.storylib.story import Story as StoryLib
12class Story(StoryLib):
13 """A class for representing a presentation story in Jupyter/IPython environment."""
15 def __init__(self, data: Data, style: Optional[Style] = None):
16 """
17 Presentation Story constructor.
19 Args:
20 data: Data set for the whole presentation story.
21 After initialization `data` can not be modified,
22 but it can be filtered.
23 style (optional): Style settings for the presentation story.
24 `style` can be changed at each presentation step.
25 """
27 super().__init__(data=data, style=style)
29 def _repr_html_(self) -> str:
30 return self.to_html()
32 def play(self) -> None:
33 """A method for displaying the assembled html code in Jupyter/IPython environment."""
35 display_html(HTML(self.to_html()))