<!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.current — 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.reader" href="IPython.nbformat.reader.html" /> <link rel="prev" title="Module: nbformat.convert" href="IPython.nbformat.convert.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.reader.html" title="Module: nbformat.reader" accesskey="N">next</a> |</li> <li class="right" > <a href="IPython.nbformat.convert.html" title="Module: nbformat.convert" 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.current</span></tt></a><ul> <li><a class="reference internal" href="#class">1 Class</a></li> <li><a class="reference internal" href="#functions">10 Functions</a></li> </ul> </li> </ul> <h4>Previous topic</h4> <p class="topless"><a href="IPython.nbformat.convert.html" title="previous chapter">Module: <tt class="docutils literal"><span class="pre">nbformat.convert</span></tt></a></p> <h4>Next topic</h4> <p class="topless"><a href="IPython.nbformat.reader.html" title="next chapter">Module: <tt class="docutils literal"><span class="pre">nbformat.reader</span></tt></a></p> <h3>This Page</h3> <ul class="this-page-menu"> <li><a href="../../_sources/api/generated/IPython.nbformat.current.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.current"> <span id="module-nbformat-current"></span><h1>Module: <tt class="xref py py-mod docutils literal"><span class="pre">nbformat.current</span></tt><a class="headerlink" href="#module-IPython.nbformat.current" title="Permalink to this headline">¶</a></h1> <p>The official API for working with notebooks in the current format version.</p> <p>Authors:</p> <ul class="simple"> <li>Brian Granger</li> <li>Jonathan Frederic</li> </ul> <div class="section" id="class"> <h2>1 Class<a class="headerlink" href="#class" title="Permalink to this headline">¶</a></h2> <dl class="class"> <dt id="IPython.nbformat.current.NBFormatError"> <em class="property">class </em><tt class="descclassname">IPython.nbformat.current.</tt><tt class="descname">NBFormatError</tt><a class="headerlink" href="#IPython.nbformat.current.NBFormatError" title="Permalink to this definition">¶</a></dt> <dd><p>Bases: <a class="reference external" href="http://docs.python.org/2/library/exceptions.html#exceptions.ValueError" title="(in Python v2.7)"><tt class="xref py py-class docutils literal"><span class="pre">exceptions.ValueError</span></tt></a></p> </dd></dl> </div> <div class="section" id="functions"> <h2>10 Functions<a class="headerlink" href="#functions" title="Permalink to this headline">¶</a></h2> <dl class="function"> <dt id="IPython.nbformat.current.docstring_nbformat_mod"> <tt class="descclassname">IPython.nbformat.current.</tt><tt class="descname">docstring_nbformat_mod</tt><big>(</big><em>func</em><big>)</big><a class="headerlink" href="#IPython.nbformat.current.docstring_nbformat_mod" title="Permalink to this definition">¶</a></dt> <dd><p>Decorator for docstrings referring to classes/functions accessed through nbformat.current.</p> <p>Put {nbformat_mod} in the docstring in place of ‘IPython.nbformat.v3’.</p> </dd></dl> <dl class="function"> <dt id="IPython.nbformat.current.parse_py"> <tt class="descclassname">IPython.nbformat.current.</tt><tt class="descname">parse_py</tt><big>(</big><em>s</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#IPython.nbformat.current.parse_py" title="Permalink to this definition">¶</a></dt> <dd><p>Parse a string into a (nbformat, string) tuple.</p> </dd></dl> <dl class="function"> <dt id="IPython.nbformat.current.reads_json"> <tt class="descclassname">IPython.nbformat.current.</tt><tt class="descname">reads_json</tt><big>(</big><em>s</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#IPython.nbformat.current.reads_json" title="Permalink to this definition">¶</a></dt> <dd><p>Read a JSON notebook from a string and return the NotebookNode object.</p> </dd></dl> <dl class="function"> <dt id="IPython.nbformat.current.writes_json"> <tt class="descclassname">IPython.nbformat.current.</tt><tt class="descname">writes_json</tt><big>(</big><em>nb</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#IPython.nbformat.current.writes_json" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="function"> <dt id="IPython.nbformat.current.reads_py"> <tt class="descclassname">IPython.nbformat.current.</tt><tt class="descname">reads_py</tt><big>(</big><em>s</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#IPython.nbformat.current.reads_py" title="Permalink to this definition">¶</a></dt> <dd><p>Read a .py notebook from a string and return the NotebookNode object.</p> </dd></dl> <dl class="function"> <dt id="IPython.nbformat.current.writes_py"> <tt class="descclassname">IPython.nbformat.current.</tt><tt class="descname">writes_py</tt><big>(</big><em>nb</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#IPython.nbformat.current.writes_py" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="function"> <dt id="IPython.nbformat.current.reads"> <tt class="descclassname">IPython.nbformat.current.</tt><tt class="descname">reads</tt><big>(</big><em>s</em>, <em>format</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#IPython.nbformat.current.reads" title="Permalink to this definition">¶</a></dt> <dd><p>Read a notebook from a string and return the NotebookNode object.</p> <p>This function properly handles notebooks of any version. The notebook returned will always be in the current version’s format.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><p class="first"><strong>s</strong> : unicode</p> <blockquote> <div><p>The raw unicode string to read the notebook from.</p> </div></blockquote> <p><strong>format</strong> : (u’json’, u’ipynb’, u’py’)</p> <blockquote> <div><p>The format that the string is in.</p> </div></blockquote> </td> </tr> <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>nb</strong> : NotebookNode</p> <blockquote class="last"> <div><p>The notebook that was read.</p> </div></blockquote> </td> </tr> </tbody> </table> </dd></dl> <dl class="function"> <dt id="IPython.nbformat.current.writes"> <tt class="descclassname">IPython.nbformat.current.</tt><tt class="descname">writes</tt><big>(</big><em>nb</em>, <em>format</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#IPython.nbformat.current.writes" title="Permalink to this definition">¶</a></dt> <dd><p>Write a notebook to a string in a given format in the current nbformat version.</p> <p>This function always writes the notebook in the current nbformat version.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><p class="first"><strong>nb</strong> : NotebookNode</p> <blockquote> <div><p>The notebook to write.</p> </div></blockquote> <p><strong>format</strong> : (u’json’, u’ipynb’, u’py’)</p> <blockquote> <div><p>The format to write the notebook in.</p> </div></blockquote> </td> </tr> <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>s</strong> : unicode</p> <blockquote class="last"> <div><p>The notebook string.</p> </div></blockquote> </td> </tr> </tbody> </table> </dd></dl> <dl class="function"> <dt id="IPython.nbformat.current.read"> <tt class="descclassname">IPython.nbformat.current.</tt><tt class="descname">read</tt><big>(</big><em>fp</em>, <em>format</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#IPython.nbformat.current.read" title="Permalink to this definition">¶</a></dt> <dd><p>Read a notebook from a file and return the NotebookNode object.</p> <p>This function properly handles notebooks of any version. The notebook returned will always be in the current version’s format.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><p class="first"><strong>fp</strong> : file</p> <blockquote> <div><p>Any file-like object with a read method.</p> </div></blockquote> <p><strong>format</strong> : (u’json’, u’ipynb’, u’py’)</p> <blockquote> <div><p>The format that the string is in.</p> </div></blockquote> </td> </tr> <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>nb</strong> : NotebookNode</p> <blockquote class="last"> <div><p>The notebook that was read.</p> </div></blockquote> </td> </tr> </tbody> </table> </dd></dl> <dl class="function"> <dt id="IPython.nbformat.current.write"> <tt class="descclassname">IPython.nbformat.current.</tt><tt class="descname">write</tt><big>(</big><em>nb</em>, <em>fp</em>, <em>format</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#IPython.nbformat.current.write" title="Permalink to this definition">¶</a></dt> <dd><p>Write a notebook to a file in a given format in the current nbformat version.</p> <p>This function always writes the notebook in the current nbformat version.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><p class="first"><strong>nb</strong> : NotebookNode</p> <blockquote> <div><p>The notebook to write.</p> </div></blockquote> <p><strong>fp</strong> : file</p> <blockquote> <div><p>Any file-like object with a write method.</p> </div></blockquote> <p><strong>format</strong> : (u’json’, u’ipynb’, u’py’)</p> <blockquote> <div><p>The format to write the notebook in.</p> </div></blockquote> </td> </tr> <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>s</strong> : unicode</p> <blockquote class="last"> <div><p>The notebook string.</p> </div></blockquote> </td> </tr> </tbody> </table> </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.reader.html" title="Module: nbformat.reader" >next</a> |</li> <li class="right" > <a href="IPython.nbformat.convert.html" title="Module: nbformat.convert" >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 Sep 02, 2015. Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3. </div> </body> </html>