<!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.v2.rwbase — 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.v3" href="IPython.nbformat.v3.html" /> <link rel="prev" title="Module: nbformat.v2.nbxml" href="IPython.nbformat.v2.nbxml.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.v3.html" title="Module: nbformat.v3" accesskey="N">next</a> |</li> <li class="right" > <a href="IPython.nbformat.v2.nbxml.html" title="Module: nbformat.v2.nbxml" 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.v2.rwbase</span></tt></a><ul> <li><a class="reference internal" href="#classes">2 Classes</a></li> <li><a class="reference internal" href="#functions">5 Functions</a></li> </ul> </li> </ul> <h4>Previous topic</h4> <p class="topless"><a href="IPython.nbformat.v2.nbxml.html" title="previous chapter">Module: <tt class="docutils literal"><span class="pre">nbformat.v2.nbxml</span></tt></a></p> <h4>Next topic</h4> <p class="topless"><a href="IPython.nbformat.v3.html" title="next chapter">Module: <tt class="docutils literal"><span class="pre">nbformat.v3</span></tt></a></p> <h3>This Page</h3> <ul class="this-page-menu"> <li><a href="../../_sources/api/generated/IPython.nbformat.v2.rwbase.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.v2.rwbase"> <span id="module-nbformat-v2-rwbase"></span><h1>Module: <tt class="xref py py-mod docutils literal"><span class="pre">nbformat.v2.rwbase</span></tt><a class="headerlink" href="#module-IPython.nbformat.v2.rwbase" title="Permalink to this headline">¶</a></h1> <p>Base classes and utilities for readers and writers.</p> <p>Authors:</p> <ul class="simple"> <li>Brian Granger</li> </ul> <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.v2.rwbase.NotebookReader"> <em class="property">class </em><tt class="descclassname">IPython.nbformat.v2.rwbase.</tt><tt class="descname">NotebookReader</tt><a class="headerlink" href="#IPython.nbformat.v2.rwbase.NotebookReader" title="Permalink to this definition">¶</a></dt> <dd><p>Bases: <a class="reference external" href="http://docs.python.org/2/library/functions.html#object" title="(in Python v2.7)"><tt class="xref py py-class docutils literal"><span class="pre">object</span></tt></a></p> <p>A class for reading notebooks.</p> <dl class="method"> <dt id="IPython.nbformat.v2.rwbase.NotebookReader.read"> <tt class="descname">read</tt><big>(</big><em>fp</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#IPython.nbformat.v2.rwbase.NotebookReader.read" title="Permalink to this definition">¶</a></dt> <dd><p>Read a notebook from a file like object</p> </dd></dl> <dl class="method"> <dt id="IPython.nbformat.v2.rwbase.NotebookReader.reads"> <tt class="descname">reads</tt><big>(</big><em>s</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#IPython.nbformat.v2.rwbase.NotebookReader.reads" title="Permalink to this definition">¶</a></dt> <dd><p>Read a notebook from a string.</p> </dd></dl> </dd></dl> <dl class="class"> <dt id="IPython.nbformat.v2.rwbase.NotebookWriter"> <em class="property">class </em><tt class="descclassname">IPython.nbformat.v2.rwbase.</tt><tt class="descname">NotebookWriter</tt><a class="headerlink" href="#IPython.nbformat.v2.rwbase.NotebookWriter" title="Permalink to this definition">¶</a></dt> <dd><p>Bases: <a class="reference external" href="http://docs.python.org/2/library/functions.html#object" title="(in Python v2.7)"><tt class="xref py py-class docutils literal"><span class="pre">object</span></tt></a></p> <p>A class for writing notebooks.</p> <dl class="method"> <dt id="IPython.nbformat.v2.rwbase.NotebookWriter.write"> <tt class="descname">write</tt><big>(</big><em>nb</em>, <em>fp</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#IPython.nbformat.v2.rwbase.NotebookWriter.write" title="Permalink to this definition">¶</a></dt> <dd><p>Write a notebook to a file like object</p> </dd></dl> <dl class="method"> <dt id="IPython.nbformat.v2.rwbase.NotebookWriter.writes"> <tt class="descname">writes</tt><big>(</big><em>nb</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#IPython.nbformat.v2.rwbase.NotebookWriter.writes" title="Permalink to this definition">¶</a></dt> <dd><p>Write a notebook to a string.</p> </dd></dl> </dd></dl> </div> <div class="section" id="functions"> <h2>5 Functions<a class="headerlink" href="#functions" title="Permalink to this headline">¶</a></h2> <dl class="function"> <dt id="IPython.nbformat.v2.rwbase.restore_bytes"> <tt class="descclassname">IPython.nbformat.v2.rwbase.</tt><tt class="descname">restore_bytes</tt><big>(</big><em>nb</em><big>)</big><a class="headerlink" href="#IPython.nbformat.v2.rwbase.restore_bytes" title="Permalink to this definition">¶</a></dt> <dd><p>Restore bytes of image data from unicode-only formats.</p> <p>Base64 encoding is handled elsewhere. Bytes objects in the notebook are always b64-encoded. We DO NOT encode/decode around file formats.</p> </dd></dl> <dl class="function"> <dt id="IPython.nbformat.v2.rwbase.rejoin_lines"> <tt class="descclassname">IPython.nbformat.v2.rwbase.</tt><tt class="descname">rejoin_lines</tt><big>(</big><em>nb</em><big>)</big><a class="headerlink" href="#IPython.nbformat.v2.rwbase.rejoin_lines" title="Permalink to this definition">¶</a></dt> <dd><p>rejoin multiline text into strings</p> <p>For reversing effects of <tt class="docutils literal"><span class="pre">split_lines(nb)</span></tt>.</p> <p>This only rejoins lines that have been split, so if text objects were not split they will pass through unchanged.</p> <p>Used when reading JSON files that may have been passed through split_lines.</p> </dd></dl> <dl class="function"> <dt id="IPython.nbformat.v2.rwbase.split_lines"> <tt class="descclassname">IPython.nbformat.v2.rwbase.</tt><tt class="descname">split_lines</tt><big>(</big><em>nb</em><big>)</big><a class="headerlink" href="#IPython.nbformat.v2.rwbase.split_lines" title="Permalink to this definition">¶</a></dt> <dd><p>split likely multiline text into lists of strings</p> <p>For file output more friendly to line-based VCS. <tt class="docutils literal"><span class="pre">rejoin_lines(nb)</span></tt> will reverse the effects of <tt class="docutils literal"><span class="pre">split_lines(nb)</span></tt>.</p> <p>Used when writing JSON files.</p> </dd></dl> <dl class="function"> <dt id="IPython.nbformat.v2.rwbase.base64_decode"> <tt class="descclassname">IPython.nbformat.v2.rwbase.</tt><tt class="descname">base64_decode</tt><big>(</big><em>nb</em><big>)</big><a class="headerlink" href="#IPython.nbformat.v2.rwbase.base64_decode" title="Permalink to this definition">¶</a></dt> <dd><p>Restore all bytes objects in the notebook from base64-encoded strings.</p> <p>Note: This is never used</p> </dd></dl> <dl class="function"> <dt id="IPython.nbformat.v2.rwbase.base64_encode"> <tt class="descclassname">IPython.nbformat.v2.rwbase.</tt><tt class="descname">base64_encode</tt><big>(</big><em>nb</em><big>)</big><a class="headerlink" href="#IPython.nbformat.v2.rwbase.base64_encode" title="Permalink to this definition">¶</a></dt> <dd><p>Base64 encode all bytes objects in the notebook.</p> <p>These will be b64-encoded unicode strings</p> <p>Note: This is never used</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.v3.html" title="Module: nbformat.v3" >next</a> |</li> <li class="right" > <a href="IPython.nbformat.v2.nbxml.html" title="Module: nbformat.v2.nbxml" >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>