Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if name not in self.scraps:
if raise_on_missing:
raise ScrapbookException(
"Scrap '{}' is not available in this notebook.".format(name)
)
else:
ip_display(
"No scrap found with name '{}' in this notebook".format(name)
)
else:
scrap = self.scraps[name]
if new_name:
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: