Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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)