<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Module: nbformat.sign — IPython 2.3.0 documentation</title> <link rel="stylesheet" href="../../_static/default.css" type="text/css" /> <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" /> <script type="text/javascript"> var DOCUMENTATION_OPTIONS = { URL_ROOT: '../../', VERSION: '2.3.0', COLLAPSE_INDEX: false, FILE_SUFFIX: '.html', HAS_SOURCE: true }; </script> <script type="text/javascript" src="../../_static/jquery.js"></script> <script type="text/javascript" src="../../_static/underscore.js"></script> <script type="text/javascript" src="../../_static/doctools.js"></script> <link rel="top" title="IPython 2.3.0 documentation" href="../../index.html" /> <link rel="up" title="The IPython API" href="../index.html" /> <link rel="next" title="Module: nbformat.v1.convert" href="IPython.nbformat.v1.convert.html" /> <link rel="prev" title="Module: nbformat.reader" href="IPython.nbformat.reader.html" /> </head> <body> <div style="background-color: white; text-align: left; padding: 10px 10px 15px 15px"> <a href="http://ipython.org/"><img src="../../_static/logo.png" border="0" alt="IPython Documentation"/></a> </div> <div class="related"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="../../genindex.html" title="General Index" accesskey="I">index</a></li> <li class="right" > <a href="../../py-modindex.html" title="Python Module Index" >modules</a> |</li> <li class="right" > <a href="IPython.nbformat.v1.convert.html" title="Module: nbformat.v1.convert" accesskey="N">next</a> |</li> <li class="right" > <a href="IPython.nbformat.reader.html" title="Module: nbformat.reader" accesskey="P">previous</a> |</li> <li><a href="http://ipython.org">home</a>| </li> <li><a href="../../search.html">search</a>| </li> <li><a href="../../index.html">documentation </a> »</li> <li><a href="../index.html" accesskey="U">The IPython API</a> »</li> </ul> </div> <div class="sphinxsidebar"> <div class="sphinxsidebarwrapper"> <h3><a href="../../index.html">Table Of Contents</a></h3> <ul> <li><a class="reference internal" href="#">Module: <tt class="docutils literal"><span class="pre">nbformat.sign</span></tt></a><ul> <li><a class="reference internal" href="#classes">2 Classes</a></li> <li><a class="reference internal" href="#functions">2 Functions</a></li> </ul> </li> </ul> <h4>Previous topic</h4> <p class="topless"><a href="IPython.nbformat.reader.html" title="previous chapter">Module: <tt class="docutils literal"><span class="pre">nbformat.reader</span></tt></a></p> <h4>Next topic</h4> <p class="topless"><a href="IPython.nbformat.v1.convert.html" title="next chapter">Module: <tt class="docutils literal"><span class="pre">nbformat.v1.convert</span></tt></a></p> <h3>This Page</h3> <ul class="this-page-menu"> <li><a href="../../_sources/api/generated/IPython.nbformat.sign.txt" rel="nofollow">Show Source</a></li> </ul> <div id="searchbox" style="display: none"> <h3>Quick search</h3> <form class="search" action="../../search.html" method="get"> <input type="text" name="q" /> <input type="submit" value="Go" /> <input type="hidden" name="check_keywords" value="yes" /> <input type="hidden" name="area" value="default" /> </form> <p class="searchtip" style="font-size: 90%"> Enter search terms or a module, class or function name. </p> </div> <script type="text/javascript">$('#searchbox').show(0);</script> </div> </div> <div class="document"> <div class="documentwrapper"> <div class="bodywrapper"> <div class="body"> <div class="section" id="module-IPython.nbformat.sign"> <span id="module-nbformat-sign"></span><h1>Module: <tt class="xref py py-mod docutils literal"><span class="pre">nbformat.sign</span></tt><a class="headerlink" href="#module-IPython.nbformat.sign" title="Permalink to this headline">¶</a></h1> <p>Functions for signing notebooks</p> <div class="section" id="classes"> <h2>2 Classes<a class="headerlink" href="#classes" title="Permalink to this headline">¶</a></h2> <dl class="class"> <dt id="IPython.nbformat.sign.NotebookNotary"> <em class="property">class </em><tt class="descclassname">IPython.nbformat.sign.</tt><tt class="descname">NotebookNotary</tt><big>(</big><em>**kwargs</em><big>)</big><a class="headerlink" href="#IPython.nbformat.sign.NotebookNotary" title="Permalink to this definition">¶</a></dt> <dd><p>Bases: <a class="reference internal" href="IPython.config.configurable.html#IPython.config.configurable.LoggingConfigurable" title="IPython.config.configurable.LoggingConfigurable"><tt class="xref py py-class docutils literal"><span class="pre">IPython.config.configurable.LoggingConfigurable</span></tt></a></p> <p>A class for computing and verifying notebook signatures.</p> <dl class="method"> <dt id="IPython.nbformat.sign.NotebookNotary.check_cells"> <tt class="descname">check_cells</tt><big>(</big><em>nb</em><big>)</big><a class="headerlink" href="#IPython.nbformat.sign.NotebookNotary.check_cells" title="Permalink to this definition">¶</a></dt> <dd><p>Return whether all code cells are trusted</p> <p>If there are no code cells, return True.</p> <p>This function is the inverse of mark_cells.</p> </dd></dl> <dl class="method"> <dt id="IPython.nbformat.sign.NotebookNotary.check_signature"> <tt class="descname">check_signature</tt><big>(</big><em>nb</em><big>)</big><a class="headerlink" href="#IPython.nbformat.sign.NotebookNotary.check_signature" title="Permalink to this definition">¶</a></dt> <dd><p>Check a notebook’s stored signature</p> <p>If a signature is stored in the notebook’s metadata, a new signature is computed and compared with the stored value.</p> <p>Returns True if the signature is found and matches, False otherwise.</p> <p>The following conditions must all be met for a notebook to be trusted: - a signature is stored in the form ‘scheme:hexdigest’ - the stored scheme matches the requested scheme - the requested scheme is available from hashlib - the computed hash from notebook_signature matches the stored hash</p> </dd></dl> <dl class="method"> <dt id="IPython.nbformat.sign.NotebookNotary.compute_signature"> <tt class="descname">compute_signature</tt><big>(</big><em>nb</em><big>)</big><a class="headerlink" href="#IPython.nbformat.sign.NotebookNotary.compute_signature" title="Permalink to this definition">¶</a></dt> <dd><p>Compute a notebook’s signature</p> <p>by hashing the entire contents of the notebook via HMAC digest.</p> </dd></dl> <dl class="method"> <dt id="IPython.nbformat.sign.NotebookNotary.mark_cells"> <tt class="descname">mark_cells</tt><big>(</big><em>nb</em>, <em>trusted</em><big>)</big><a class="headerlink" href="#IPython.nbformat.sign.NotebookNotary.mark_cells" title="Permalink to this definition">¶</a></dt> <dd><p>Mark cells as trusted if the notebook’s signature can be verified</p> <p>Sets <tt class="docutils literal"><span class="pre">cell.trusted</span> <span class="pre">=</span> <span class="pre">True</span> <span class="pre">|</span> <span class="pre">False</span></tt> on all code cells, depending on whether the stored signature can be verified.</p> <p>This function is the inverse of check_cells</p> </dd></dl> <dl class="method"> <dt id="IPython.nbformat.sign.NotebookNotary.sign"> <tt class="descname">sign</tt><big>(</big><em>nb</em><big>)</big><a class="headerlink" href="#IPython.nbformat.sign.NotebookNotary.sign" title="Permalink to this definition">¶</a></dt> <dd><p>Sign a notebook, indicating that its output is trusted</p> <p>stores ‘algo:hmac-hexdigest’ in notebook.metadata.signature</p> <p>e.g. ‘sha256:deadbeef123...’</p> </dd></dl> </dd></dl> <dl class="class"> <dt id="IPython.nbformat.sign.TrustNotebookApp"> <em class="property">class </em><tt class="descclassname">IPython.nbformat.sign.</tt><tt class="descname">TrustNotebookApp</tt><big>(</big><em>**kwargs</em><big>)</big><a class="headerlink" href="#IPython.nbformat.sign.TrustNotebookApp" title="Permalink to this definition">¶</a></dt> <dd><p>Bases: <a class="reference internal" href="IPython.core.application.html#IPython.core.application.BaseIPythonApplication" title="IPython.core.application.BaseIPythonApplication"><tt class="xref py py-class docutils literal"><span class="pre">IPython.core.application.BaseIPythonApplication</span></tt></a></p> <dl class="method"> <dt id="IPython.nbformat.sign.TrustNotebookApp.generate_new_key"> <tt class="descname">generate_new_key</tt><big>(</big><big>)</big><a class="headerlink" href="#IPython.nbformat.sign.TrustNotebookApp.generate_new_key" title="Permalink to this definition">¶</a></dt> <dd><p>Generate a new notebook signature key</p> </dd></dl> </dd></dl> </div> <div class="section" id="functions"> <h2>2 Functions<a class="headerlink" href="#functions" title="Permalink to this headline">¶</a></h2> <dl class="function"> <dt id="IPython.nbformat.sign.yield_everything"> <tt class="descclassname">IPython.nbformat.sign.</tt><tt class="descname">yield_everything</tt><big>(</big><em>obj</em><big>)</big><a class="headerlink" href="#IPython.nbformat.sign.yield_everything" title="Permalink to this definition">¶</a></dt> <dd><p>Yield every item in a container as bytes</p> <p>Allows any JSONable object to be passed to an HMAC digester without having to serialize the whole thing.</p> </dd></dl> <dl class="function"> <dt id="IPython.nbformat.sign.signature_removed"> <tt class="descclassname">IPython.nbformat.sign.</tt><tt class="descname">signature_removed</tt><big>(</big><em>*args</em>, <em>**kwds</em><big>)</big><a class="headerlink" href="#IPython.nbformat.sign.signature_removed" title="Permalink to this definition">¶</a></dt> <dd><p>Context manager for operating on a notebook with its signature removed</p> <p>Used for excluding the previous signature when computing a notebook’s signature.</p> </dd></dl> </div> </div> </div> </div> </div> <div class="clearer"></div> </div> <div class="related"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="../../genindex.html" title="General Index" >index</a></li> <li class="right" > <a href="../../py-modindex.html" title="Python Module Index" >modules</a> |</li> <li class="right" > <a href="IPython.nbformat.v1.convert.html" title="Module: nbformat.v1.convert" >next</a> |</li> <li class="right" > <a href="IPython.nbformat.reader.html" title="Module: nbformat.reader" >previous</a> |</li> <li><a href="http://ipython.org">home</a>| </li> <li><a href="../../search.html">search</a>| </li> <li><a href="../../index.html">documentation </a> »</li> <li><a href="../index.html" >The IPython API</a> »</li> </ul> </div> <div class="footer"> © Copyright The IPython Development Team. Last updated on Jul 14, 2015. Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3. </div> </body> </html>