How to use the scrapbook.utils.kernel_required function in scrapbook

To help you get started, we’ve selected a few scrapbook examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nteract / scrapbook / scrapbook / models.py View on Github external
    @kernel_required
    def reglue(self, name, new_name=None, raise_on_missing=True, unattached=False):
        """
        Display output from a named source of the notebook.

        Parameters
        ----------
        name : str
            name of scrap object
        new_name : str
            replacement name for scrap
        raise_error : bool
            indicator for if the resketch should print a message or error on missing snaps
        unattached : bool
            indicator for rendering without making the display recallable as scrapbook data
        """
        # Avoid circular imports
github nteract / scrapbook / scrapbook / api.py View on Github external
@kernel_required
def glue(name, scrap, encoder=None, display=None):
    """
    Records a scrap (data value) in the given notebook cell.

    The scrap (recorded value) can be retrieved during later inspection of the
    output notebook.

    The data type of the scraps is implied by the value type of any of the
    registered data encoders, but can be overwritten by setting the `encoder`
    argument to a particular encoder's registered name (e.g. `"json"`).

    This data is persisted by generating a display output with a special media
    type identifying the content storage encoder and data. These outputs are not
    visible in notebook rendering but still exist in the document. Scrapbook
    then can rehydrate the data associated with the notebook in the future by
    reading these cell outputs.