Coverage for src/metador_core/widget/jupyter/__init__.py: 0%
15 statements
« prev ^ index » next coverage.py v7.3.2, created at 2023-11-02 09:33 +0000
« prev ^ index » next coverage.py v7.3.2, created at 2023-11-02 09:33 +0000
1"""Functionality to make widgets and dashboard work stand-alone in Jupyter."""
3import wrapt
5from ...container import MetadorContainer
6from . import standalone
9class Previewable(wrapt.ObjectProxy):
10 """Wrapper to be used around MetadorContainer inside Jupyter.
12 Will ensure that widgets can work in the notebook.
13 """
15 def __init__(self, container: MetadorContainer):
16 super().__init__(container)
18 if not standalone.running():
19 standalone.run()
21 if provider := standalone.container_provider():
22 provider[str(self.metador.container_uuid)] = self
24 def close(self, *args, **kwargs):
25 if provider := standalone.container_provider():
26 del provider[str(self.metador.container_uuid)]
28 self.__wrapped__.close(*args, **kwargs)
31__all__ = ["Previewable"]