class_docstr: A class for computing and verifying notebook signatures.
class_docstr_tok: ["A","class","for","computing","and","verifying","notebook","signatures","."]
docstr: Do we trust an individual cell?
  
  Return True if:
  
  - cell is explicitly trusted
  - cell has no potentially unsafe rich output
  
  If a cell has no output, or only simple print statements,
  it will always be trusted.
docstr_tok: ["Do","we","trust","an","individual","cell","?","Return","True","if",":","-","cell","is","explicitly","trusted","-","cell","has","no","potentially","unsafe","rich","output","If","a","cell","has","no","output",",","or","only","simple","print","statements",",","it","will","always","be","trusted","."]
code: def _check_cell(self, cell, nbformat_version):
      """Do we trust an individual cell?
  
      Return True if:
  
      - cell is explicitly trusted
      - cell has no potentially unsafe rich output
  
      If a cell has no output, or only simple print statements,
      it will always be trusted.
      """
      # explicitly trusted
      if cell["metadata"].pop("trusted", False):
          return True
  
      # explicitly safe output
      if nbformat_version >= 4:
          unsafe_output_types = ["execute_result", "display_data"]
          safe_keys = {"output_type", "execution_count", "metadata"}
      else:  # v3
          unsafe_output_types = ["pyout", "display_data"]
          safe_keys = {"output_type", "prompt_number", "metadata"}
  
      for output in cell["outputs"]:
          output_type = output["output_type"]
          if output_type in unsafe_output_types:
              # if there are any data keys not in the safe whitelist
              output_keys = set(output)
              if output_keys.difference(safe_keys):
                  return False
  
      return True
  
imports: from __future__ import annotations
  import hashlib
  import os
  import sys
  import typing
  from collections import OrderedDict
  from contextlib import contextmanager
  from datetime import datetime, timezone
  from hmac import HMAC
  from pathlib import Path
  from jupyter_core.paths import jupyter_data_dir
  from base64 import encodebytes
  from jupyter_core.application import JupyterApp, base_flags
  from traitlets import Any, Bool, Bytes, Callable, Enum, Instance, Integer, Unicode, default, observe
  from traitlets.config import LoggingConfigurable
  from .None import NO_CONVERT, __version__, read, reads
label_desc: Use image node_id 15 for calling the NotebookNotary obj's underlying member method code with example usage: obj._check_cell(cell, nbformat_version) and returns: True, True, False