How to use the scrapbook.api._prepare_ipy_display_format 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
scrap = scrap._replace(name=new_name)
            if scrap.data is not None:
                data, metadata = _prepare_ipy_data_format(
                    scrap.name, scrap_to_payload(scrap), scrap.encoder
                )
                # Skip saving data for later regluing and remove 'scrapbook'
                # from keys, when unattached
                if unattached:
                    metadata = self._strip_scrapbook_metadata(metadata)
                ip_display(data, metadata=metadata, raw=True)
            if scrap.display is not None:
                scrap_data = scrap.display.get("data", {})
                scrap_metadata = self._strip_scrapbook_metadata(
                    scrap.display.get("metadata", {})
                )
                data, metadata = _prepare_ipy_display_format(
                    scrap.name, scrap_data, scrap_metadata
                )
                if unattached:
                    # Remove 'scrapbook' from keys if we want it unassociated
                    metadata = self._strip_scrapbook_metadata(metadata)
                ip_display(data, metadata=metadata, raw=True)