Sophie

Sophie

distrib > Mageia > 5 > x86_64 > media > core-updates > by-pkgid > b9a6a1b9f2781444d2917afd8e4421ab > files > 745

ipython-doc-2.3.0-2.2.mga5.noarch.rpm

<!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: lib.demo &mdash; 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: lib.display" href="IPython.lib.display.html" />
    <link rel="prev" title="Module: lib.deepreload" href="IPython.lib.deepreload.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.lib.display.html" title="Module: lib.display"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="IPython.lib.deepreload.html" title="Module: lib.deepreload"
             accesskey="P">previous</a> |</li>
        <li><a href="http://ipython.org">home</a>|&nbsp;</li>
        <li><a href="../../search.html">search</a>|&nbsp;</li>
       <li><a href="../../index.html">documentation </a> &raquo;</li>

          <li><a href="../index.html" accesskey="U">The IPython API</a> &raquo;</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">lib.demo</span></tt></a><ul>
<li><a class="reference internal" href="#provided-classes">Provided classes</a></li>
<li><a class="reference internal" href="#subclassing">Subclassing</a></li>
<li><a class="reference internal" href="#operation">Operation</a></li>
<li><a class="reference internal" href="#example">Example</a></li>
<li><a class="reference internal" href="#classes">8 Classes</a></li>
<li><a class="reference internal" href="#function">1 Function</a></li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="IPython.lib.deepreload.html"
                        title="previous chapter">Module: <tt class="docutils literal"><span class="pre">lib.deepreload</span></tt></a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="IPython.lib.display.html"
                        title="next chapter">Module: <tt class="docutils literal"><span class="pre">lib.display</span></tt></a></p>
  <h3>This Page</h3>
  <ul class="this-page-menu">
    <li><a href="../../_sources/api/generated/IPython.lib.demo.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.lib.demo">
<span id="module-lib-demo"></span><h1>Module: <tt class="xref py py-mod docutils literal"><span class="pre">lib.demo</span></tt><a class="headerlink" href="#module-IPython.lib.demo" title="Permalink to this headline">¶</a></h1>
<p>Module for interactive demos using IPython.</p>
<p>This module implements a few classes for running Python scripts interactively
in IPython for demonstrations.  With very simple markup (a few tags in
comments), you can control points where the script stops executing and returns
control to IPython.</p>
<div class="section" id="provided-classes">
<h2>Provided classes<a class="headerlink" href="#provided-classes" title="Permalink to this headline">¶</a></h2>
<p>The classes are (see their docstrings for further details):</p>
<blockquote>
<div><ul class="simple">
<li>Demo: pure python demos</li>
<li>IPythonDemo: demos with input to be processed by IPython as if it had been
typed interactively (so magics work, as well as any other special syntax you
may have added via input prefilters).</li>
<li>LineDemo: single-line version of the Demo class.  These demos are executed
one line at a time, and require no markup.</li>
<li>IPythonLineDemo: IPython version of the LineDemo class (the demo is
executed a line at a time, but processed via IPython).</li>
<li>ClearMixin: mixin to make Demo classes with less visual clutter.  It
declares an empty marquee and a pre_cmd that clears the screen before each
block (see Subclassing below).</li>
<li>ClearDemo, ClearIPDemo: mixin-enabled versions of the Demo and IPythonDemo
classes.</li>
</ul>
</div></blockquote>
<p>Inheritance diagram:</p>
<p class="graphviz">
digraph inheritance21dba67aa2 {
rankdir=LR;
size=&quot;8.0, 12.0&quot;;
  &quot;lib.demo.ClearDemo&quot; [style=&quot;setlinewidth(0.5)&quot;,URL=&quot;#IPython.lib.demo.ClearDemo&quot;,fontname=&quot;Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans&quot;,height=0.25,shape=box,fontsize=10];
  &quot;lib.demo.ClearMixin&quot; -&gt; &quot;lib.demo.ClearDemo&quot; [arrowsize=0.5,style=&quot;setlinewidth(0.5)&quot;];
  &quot;lib.demo.Demo&quot; -&gt; &quot;lib.demo.ClearDemo&quot; [arrowsize=0.5,style=&quot;setlinewidth(0.5)&quot;];
  &quot;lib.demo.ClearIPDemo&quot; [style=&quot;setlinewidth(0.5)&quot;,URL=&quot;#IPython.lib.demo.ClearIPDemo&quot;,fontname=&quot;Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans&quot;,height=0.25,shape=box,fontsize=10];
  &quot;lib.demo.ClearMixin&quot; -&gt; &quot;lib.demo.ClearIPDemo&quot; [arrowsize=0.5,style=&quot;setlinewidth(0.5)&quot;];
  &quot;lib.demo.IPythonDemo&quot; -&gt; &quot;lib.demo.ClearIPDemo&quot; [arrowsize=0.5,style=&quot;setlinewidth(0.5)&quot;];
  &quot;lib.demo.ClearMixin&quot; [style=&quot;setlinewidth(0.5)&quot;,URL=&quot;#IPython.lib.demo.ClearMixin&quot;,fontname=&quot;Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans&quot;,tooltip=&quot;Use this mixin to make Demo classes with less visual clutter.&quot;,height=0.25,shape=box,fontsize=10];
  &quot;lib.demo.Demo&quot; [style=&quot;setlinewidth(0.5)&quot;,URL=&quot;#IPython.lib.demo.Demo&quot;,fontname=&quot;Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans&quot;,height=0.25,shape=box,fontsize=10];
  &quot;lib.demo.DemoError&quot; [style=&quot;setlinewidth(0.5)&quot;,URL=&quot;#IPython.lib.demo.DemoError&quot;,fontname=&quot;Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans&quot;,height=0.25,shape=box,fontsize=10];
  &quot;lib.demo.IPythonDemo&quot; [style=&quot;setlinewidth(0.5)&quot;,URL=&quot;#IPython.lib.demo.IPythonDemo&quot;,fontname=&quot;Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans&quot;,tooltip=&quot;Class for interactive demos with IPython's input processing applied.&quot;,height=0.25,shape=box,fontsize=10];
  &quot;lib.demo.Demo&quot; -&gt; &quot;lib.demo.IPythonDemo&quot; [arrowsize=0.5,style=&quot;setlinewidth(0.5)&quot;];
  &quot;lib.demo.IPythonLineDemo&quot; [style=&quot;setlinewidth(0.5)&quot;,URL=&quot;#IPython.lib.demo.IPythonLineDemo&quot;,fontname=&quot;Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans&quot;,tooltip=&quot;Variant of the LineDemo class whose input is processed by IPython.&quot;,height=0.25,shape=box,fontsize=10];
  &quot;lib.demo.IPythonDemo&quot; -&gt; &quot;lib.demo.IPythonLineDemo&quot; [arrowsize=0.5,style=&quot;setlinewidth(0.5)&quot;];
  &quot;lib.demo.LineDemo&quot; -&gt; &quot;lib.demo.IPythonLineDemo&quot; [arrowsize=0.5,style=&quot;setlinewidth(0.5)&quot;];
  &quot;lib.demo.LineDemo&quot; [style=&quot;setlinewidth(0.5)&quot;,URL=&quot;#IPython.lib.demo.LineDemo&quot;,fontname=&quot;Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans&quot;,tooltip=&quot;Demo where each line is executed as a separate block.&quot;,height=0.25,shape=box,fontsize=10];
  &quot;lib.demo.Demo&quot; -&gt; &quot;lib.demo.LineDemo&quot; [arrowsize=0.5,style=&quot;setlinewidth(0.5)&quot;];
}
</p>
</div>
<div class="section" id="subclassing">
<h2>Subclassing<a class="headerlink" href="#subclassing" title="Permalink to this headline">¶</a></h2>
<p>The classes here all include a few methods meant to make customization by
subclassing more convenient.  Their docstrings below have some more details:</p>
<blockquote>
<div><ul class="simple">
<li>marquee(): generates a marquee to provide visible on-screen markers at each
block start and end.</li>
<li>pre_cmd(): run right before the execution of each block.</li>
<li>post_cmd(): run right after the execution of each block.  If the block
raises an exception, this is NOT called.</li>
</ul>
</div></blockquote>
</div>
<div class="section" id="operation">
<h2>Operation<a class="headerlink" href="#operation" title="Permalink to this headline">¶</a></h2>
<p>The file is run in its own empty namespace (though you can pass it a string of
arguments as if in a command line environment, and it will see those as
sys.argv).  But at each stop, the global IPython namespace is updated with the
current internal demo namespace, so you can work interactively with the data
accumulated so far.</p>
<p>By default, each block of code is printed (with syntax highlighting) before
executing it and you have to confirm execution.  This is intended to show the
code to an audience first so you can discuss it, and only proceed with
execution once you agree.  There are a few tags which allow you to modify this
behavior.</p>
<p>The supported tags are:</p>
<p># &lt;demo&gt; stop</p>
<blockquote>
<div><p>Defines block boundaries, the points where IPython stops execution of the
file and returns to the interactive prompt.</p>
<p>You can optionally mark the stop tag with extra dashes before and after the
word &#8216;stop&#8217;, to help visually distinguish the blocks in a text editor:</p>
<p># &lt;demo&gt; &#8212; stop &#8212;</p>
</div></blockquote>
<p># &lt;demo&gt; silent</p>
<blockquote>
<div>Make a block execute silently (and hence automatically).  Typically used in
cases where you have some boilerplate or initialization code which you need
executed but do not want to be seen in the demo.</div></blockquote>
<p># &lt;demo&gt; auto</p>
<blockquote>
<div>Make a block execute automatically, but still being printed.  Useful for
simple code which does not warrant discussion, since it avoids the extra
manual confirmation.</div></blockquote>
<p># &lt;demo&gt; auto_all</p>
<blockquote>
<div>This tag can _only_ be in the first block, and if given it overrides the
individual auto tags to make the whole demo fully automatic (no block asks
for confirmation).  It can also be given at creation time (or the attribute
set later) to override what&#8217;s in the file.</div></blockquote>
<p>While _any_ python file can be run as a Demo instance, if there are no stop
tags the whole file will run in a single block (no different that calling
first %pycat and then %run).  The minimal markup to make this useful is to
place a set of stop tags; the other tags are only there to let you fine-tune
the execution.</p>
<p>This is probably best explained with the simple example file below.  You can
copy this into a file named ex_demo.py, and try running it via:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">IPython.demo</span> <span class="kn">import</span> <span class="n">Demo</span>
<span class="n">d</span> <span class="o">=</span> <span class="n">Demo</span><span class="p">(</span><span class="s">&#39;ex_demo.py&#39;</span><span class="p">)</span>
<span class="n">d</span><span class="p">()</span>
</pre></div>
</div>
<p>Each time you call the demo object, it runs the next block.  The demo object
has a few useful methods for navigation, like again(), edit(), jump(), seek()
and back().  It can be reset for a new run via reset() or reloaded from disk
(in case you&#8217;ve edited the source) via reload().  See their docstrings below.</p>
<p>Note: To make this simpler to explore, a file called &#8220;demo-exercizer.py&#8221; has
been added to the &#8220;docs/examples/core&#8221; directory.  Just cd to this directory in
an IPython session, and type:</p>
<div class="highlight-python"><div class="highlight"><pre>%run demo-exercizer.py
</pre></div>
</div>
<p>and then follow the directions.</p>
</div>
<div class="section" id="example">
<h2>Example<a class="headerlink" href="#example" title="Permalink to this headline">¶</a></h2>
<p>The following is a very simple example of a valid demo file.</p>
<div class="highlight-python"><div class="highlight"><pre><span class="c">#################### EXAMPLE DEMO &lt;ex_demo.py&gt; ###############################</span>
<span class="sd">&#39;&#39;&#39;A simple interactive demo to illustrate the use of IPython&#39;s Demo class.&#39;&#39;&#39;</span>

<span class="k">print</span> <span class="s">&#39;Hello, welcome to an interactive IPython demo.&#39;</span>

<span class="c"># The mark below defines a block boundary, which is a point where IPython will</span>
<span class="c"># stop execution and return to the interactive prompt. The dashes are actually</span>
<span class="c"># optional and used only as a visual aid to clearly separate blocks while</span>
<span class="c"># editing the demo code.</span>
<span class="c"># &lt;demo&gt; stop</span>

<span class="n">x</span> <span class="o">=</span> <span class="mi">1</span>
<span class="n">y</span> <span class="o">=</span> <span class="mi">2</span>

<span class="c"># &lt;demo&gt; stop</span>

<span class="c"># the mark below makes this block as silent</span>
<span class="c"># &lt;demo&gt; silent</span>

<span class="k">print</span> <span class="s">&#39;This is a silent block, which gets executed but not printed.&#39;</span>

<span class="c"># &lt;demo&gt; stop</span>
<span class="c"># &lt;demo&gt; auto</span>
<span class="k">print</span> <span class="s">&#39;This is an automatic block.&#39;</span>
<span class="k">print</span> <span class="s">&#39;It is executed without asking for confirmation, but printed.&#39;</span>
<span class="n">z</span> <span class="o">=</span> <span class="n">x</span><span class="o">+</span><span class="n">y</span>

<span class="k">print</span> <span class="s">&#39;z=&#39;</span><span class="p">,</span><span class="n">x</span>

<span class="c"># &lt;demo&gt; stop</span>
<span class="c"># This is just another normal block.</span>
<span class="k">print</span> <span class="s">&#39;z is now:&#39;</span><span class="p">,</span> <span class="n">z</span>

<span class="k">print</span> <span class="s">&#39;bye!&#39;</span>
<span class="c">################### END EXAMPLE DEMO &lt;ex_demo.py&gt; ############################</span>
</pre></div>
</div>
</div>
<div class="section" id="classes">
<h2>8 Classes<a class="headerlink" href="#classes" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="IPython.lib.demo.DemoError">
<em class="property">class </em><tt class="descclassname">IPython.lib.demo.</tt><tt class="descname">DemoError</tt><a class="headerlink" href="#IPython.lib.demo.DemoError" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference external" href="http://docs.python.org/2/library/exceptions.html#exceptions.Exception" title="(in Python v2.7)"><tt class="xref py py-class docutils literal"><span class="pre">exceptions.Exception</span></tt></a></p>
</dd></dl>

<dl class="class">
<dt id="IPython.lib.demo.Demo">
<em class="property">class </em><tt class="descclassname">IPython.lib.demo.</tt><tt class="descname">Demo</tt><big>(</big><em>src</em>, <em>title=u''</em>, <em>arg_str=u''</em>, <em>auto_all=None</em><big>)</big><a class="headerlink" href="#IPython.lib.demo.Demo" 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>
<dl class="method">
<dt id="IPython.lib.demo.Demo.__init__">
<tt class="descname">__init__</tt><big>(</big><em>src</em>, <em>title=u''</em>, <em>arg_str=u''</em>, <em>auto_all=None</em><big>)</big><a class="headerlink" href="#IPython.lib.demo.Demo.__init__" title="Permalink to this definition">¶</a></dt>
<dd><p>Make a new demo object.  To run the demo, simply call the object.</p>
<p>See the module docstring for full details and an example (you can use
IPython.Demo? in IPython to see it).</p>
<p>Inputs:</p>
<blockquote>
<div><ul>
<li><dl class="first docutils">
<dt>src is either a file, or file-like object, or a</dt>
<dd><p class="first last">string that can be resolved to a filename.</p>
</dd>
</dl>
</li>
</ul>
</div></blockquote>
<p>Optional inputs:</p>
<blockquote>
<div><ul class="simple">
<li>title: a string to use as the demo name.  Of most use when the demo
you are making comes from an object that has no filename, or if you
want an alternate denotation distinct from the filename.</li>
<li>arg_str(&#8216;&#8217;): a string of arguments, internally converted to a list
just like sys.argv, so the demo script can see a similar
environment.</li>
<li>auto_all(None): global flag to run all blocks automatically without
confirmation.  This attribute overrides the block-level tags and
applies to the whole demo.  It is an attribute of the object, and
can be changed at runtime simply by reassigning it to a boolean
value.</li>
</ul>
</div></blockquote>
</dd></dl>

<dl class="method">
<dt id="IPython.lib.demo.Demo.again">
<tt class="descname">again</tt><big>(</big><big>)</big><a class="headerlink" href="#IPython.lib.demo.Demo.again" title="Permalink to this definition">¶</a></dt>
<dd><p>Move the seek pointer back one block and re-execute.</p>
</dd></dl>

<dl class="method">
<dt id="IPython.lib.demo.Demo.back">
<tt class="descname">back</tt><big>(</big><em>num=1</em><big>)</big><a class="headerlink" href="#IPython.lib.demo.Demo.back" title="Permalink to this definition">¶</a></dt>
<dd><p>Move the seek pointer back num blocks (default is 1).</p>
</dd></dl>

<dl class="method">
<dt id="IPython.lib.demo.Demo.edit">
<tt class="descname">edit</tt><big>(</big><em>index=None</em><big>)</big><a class="headerlink" href="#IPython.lib.demo.Demo.edit" title="Permalink to this definition">¶</a></dt>
<dd><p>Edit a block.</p>
<p>If no number is given, use the last block executed.</p>
<p>This edits the in-memory copy of the demo, it does NOT modify the
original source file.  If you want to do that, simply open the file in
an editor and use reload() when you make changes to the file.  This
method is meant to let you change a block during a demonstration for
explanatory purposes, without damaging your original script.</p>
</dd></dl>

<dl class="method">
<dt id="IPython.lib.demo.Demo.fload">
<tt class="descname">fload</tt><big>(</big><big>)</big><a class="headerlink" href="#IPython.lib.demo.Demo.fload" title="Permalink to this definition">¶</a></dt>
<dd><p>Load file object.</p>
</dd></dl>

<dl class="method">
<dt id="IPython.lib.demo.Demo.jump">
<tt class="descname">jump</tt><big>(</big><em>num=1</em><big>)</big><a class="headerlink" href="#IPython.lib.demo.Demo.jump" title="Permalink to this definition">¶</a></dt>
<dd><p>Jump a given number of blocks relative to the current one.</p>
<p>The offset can be positive or negative, defaults to 1.</p>
</dd></dl>

<dl class="method">
<dt id="IPython.lib.demo.Demo.marquee">
<tt class="descname">marquee</tt><big>(</big><em>txt=u''</em>, <em>width=78</em>, <em>mark=u'*'</em><big>)</big><a class="headerlink" href="#IPython.lib.demo.Demo.marquee" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the input string centered in a &#8216;marquee&#8217;.</p>
</dd></dl>

<dl class="method">
<dt id="IPython.lib.demo.Demo.post_cmd">
<tt class="descname">post_cmd</tt><big>(</big><big>)</big><a class="headerlink" href="#IPython.lib.demo.Demo.post_cmd" title="Permalink to this definition">¶</a></dt>
<dd><p>Method called after executing each block.</p>
</dd></dl>

<dl class="method">
<dt id="IPython.lib.demo.Demo.pre_cmd">
<tt class="descname">pre_cmd</tt><big>(</big><big>)</big><a class="headerlink" href="#IPython.lib.demo.Demo.pre_cmd" title="Permalink to this definition">¶</a></dt>
<dd><p>Method called before executing each block.</p>
</dd></dl>

<dl class="method">
<dt id="IPython.lib.demo.Demo.reload">
<tt class="descname">reload</tt><big>(</big><big>)</big><a class="headerlink" href="#IPython.lib.demo.Demo.reload" title="Permalink to this definition">¶</a></dt>
<dd><p>Reload source from disk and initialize state.</p>
</dd></dl>

<dl class="method">
<dt id="IPython.lib.demo.Demo.reset">
<tt class="descname">reset</tt><big>(</big><big>)</big><a class="headerlink" href="#IPython.lib.demo.Demo.reset" title="Permalink to this definition">¶</a></dt>
<dd><p>Reset the namespace and seek pointer to restart the demo</p>
</dd></dl>

<dl class="method">
<dt id="IPython.lib.demo.Demo.run_cell">
<tt class="descname">run_cell</tt><big>(</big><em>source</em><big>)</big><a class="headerlink" href="#IPython.lib.demo.Demo.run_cell" title="Permalink to this definition">¶</a></dt>
<dd><p>Execute a string with one or more lines of code</p>
</dd></dl>

<dl class="method">
<dt id="IPython.lib.demo.Demo.seek">
<tt class="descname">seek</tt><big>(</big><em>index</em><big>)</big><a class="headerlink" href="#IPython.lib.demo.Demo.seek" title="Permalink to this definition">¶</a></dt>
<dd><p>Move the current seek pointer to the given block.</p>
<p>You can use negative indices to seek from the end, with identical
semantics to those of Python lists.</p>
</dd></dl>

<dl class="method">
<dt id="IPython.lib.demo.Demo.show">
<tt class="descname">show</tt><big>(</big><em>index=None</em><big>)</big><a class="headerlink" href="#IPython.lib.demo.Demo.show" title="Permalink to this definition">¶</a></dt>
<dd><p>Show a single block on screen</p>
</dd></dl>

<dl class="method">
<dt id="IPython.lib.demo.Demo.show_all">
<tt class="descname">show_all</tt><big>(</big><big>)</big><a class="headerlink" href="#IPython.lib.demo.Demo.show_all" title="Permalink to this definition">¶</a></dt>
<dd><p>Show entire demo on screen, block by block</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="IPython.lib.demo.IPythonDemo">
<em class="property">class </em><tt class="descclassname">IPython.lib.demo.</tt><tt class="descname">IPythonDemo</tt><big>(</big><em>src</em>, <em>title=u''</em>, <em>arg_str=u''</em>, <em>auto_all=None</em><big>)</big><a class="headerlink" href="#IPython.lib.demo.IPythonDemo" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#IPython.lib.demo.Demo" title="IPython.lib.demo.Demo"><tt class="xref py py-class docutils literal"><span class="pre">IPython.lib.demo.Demo</span></tt></a></p>
<p>Class for interactive demos with IPython&#8217;s input processing applied.</p>
<p>This subclasses Demo, but instead of executing each block by the Python
interpreter (via exec), it actually calls IPython on it, so that any input
filters which may be in place are applied to the input block.</p>
<p>If you have an interactive environment which exposes special input
processing, you can use this class instead to write demo scripts which
operate exactly as if you had typed them interactively.  The default Demo
class requires the input to be valid, pure Python code.</p>
<dl class="method">
<dt id="IPython.lib.demo.IPythonDemo.run_cell">
<tt class="descname">run_cell</tt><big>(</big><em>source</em><big>)</big><a class="headerlink" href="#IPython.lib.demo.IPythonDemo.run_cell" title="Permalink to this definition">¶</a></dt>
<dd><p>Execute a string with one or more lines of code</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="IPython.lib.demo.LineDemo">
<em class="property">class </em><tt class="descclassname">IPython.lib.demo.</tt><tt class="descname">LineDemo</tt><big>(</big><em>src</em>, <em>title=u''</em>, <em>arg_str=u''</em>, <em>auto_all=None</em><big>)</big><a class="headerlink" href="#IPython.lib.demo.LineDemo" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#IPython.lib.demo.Demo" title="IPython.lib.demo.Demo"><tt class="xref py py-class docutils literal"><span class="pre">IPython.lib.demo.Demo</span></tt></a></p>
<p>Demo where each line is executed as a separate block.</p>
<p>The input script should be valid Python code.</p>
<p>This class doesn&#8217;t require any markup at all, and it&#8217;s meant for simple
scripts (with no nesting or any kind of indentation) which consist of
multiple lines of input to be executed, one at a time, as if they had been
typed in the interactive prompt.</p>
<p>Note: the input can not have <em>any</em> indentation, which means that only
single-lines of input are accepted, not even function definitions are
valid.</p>
<dl class="method">
<dt id="IPython.lib.demo.LineDemo.reload">
<tt class="descname">reload</tt><big>(</big><big>)</big><a class="headerlink" href="#IPython.lib.demo.LineDemo.reload" title="Permalink to this definition">¶</a></dt>
<dd><p>Reload source from disk and initialize state.</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="IPython.lib.demo.IPythonLineDemo">
<em class="property">class </em><tt class="descclassname">IPython.lib.demo.</tt><tt class="descname">IPythonLineDemo</tt><big>(</big><em>src</em>, <em>title=u''</em>, <em>arg_str=u''</em>, <em>auto_all=None</em><big>)</big><a class="headerlink" href="#IPython.lib.demo.IPythonLineDemo" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#IPython.lib.demo.IPythonDemo" title="IPython.lib.demo.IPythonDemo"><tt class="xref py py-class docutils literal"><span class="pre">IPython.lib.demo.IPythonDemo</span></tt></a>, <a class="reference internal" href="#IPython.lib.demo.LineDemo" title="IPython.lib.demo.LineDemo"><tt class="xref py py-class docutils literal"><span class="pre">IPython.lib.demo.LineDemo</span></tt></a></p>
<p>Variant of the LineDemo class whose input is processed by IPython.</p>
</dd></dl>

<dl class="class">
<dt id="IPython.lib.demo.ClearMixin">
<em class="property">class </em><tt class="descclassname">IPython.lib.demo.</tt><tt class="descname">ClearMixin</tt><a class="headerlink" href="#IPython.lib.demo.ClearMixin" 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>Use this mixin to make Demo classes with less visual clutter.</p>
<p>Demos using this mixin will clear the screen before every block and use
blank marquees.</p>
<p>Note that in order for the methods defined here to actually override those
of the classes it&#8217;s mixed with, it must go /first/ in the inheritance
tree.  For example:</p>
<blockquote>
<div>class ClearIPDemo(ClearMixin,IPythonDemo): pass</div></blockquote>
<p>will provide an IPythonDemo class with the mixin&#8217;s features.</p>
<dl class="method">
<dt id="IPython.lib.demo.ClearMixin.marquee">
<tt class="descname">marquee</tt><big>(</big><em>txt=u''</em>, <em>width=78</em>, <em>mark=u'*'</em><big>)</big><a class="headerlink" href="#IPython.lib.demo.ClearMixin.marquee" title="Permalink to this definition">¶</a></dt>
<dd><p>Blank marquee that returns &#8216;&#8217; no matter what the input.</p>
</dd></dl>

<dl class="method">
<dt id="IPython.lib.demo.ClearMixin.pre_cmd">
<tt class="descname">pre_cmd</tt><big>(</big><big>)</big><a class="headerlink" href="#IPython.lib.demo.ClearMixin.pre_cmd" title="Permalink to this definition">¶</a></dt>
<dd><p>Method called before executing each block.</p>
<p>This one simply clears the screen.</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="IPython.lib.demo.ClearDemo">
<em class="property">class </em><tt class="descclassname">IPython.lib.demo.</tt><tt class="descname">ClearDemo</tt><big>(</big><em>src</em>, <em>title=u''</em>, <em>arg_str=u''</em>, <em>auto_all=None</em><big>)</big><a class="headerlink" href="#IPython.lib.demo.ClearDemo" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#IPython.lib.demo.ClearMixin" title="IPython.lib.demo.ClearMixin"><tt class="xref py py-class docutils literal"><span class="pre">IPython.lib.demo.ClearMixin</span></tt></a>, <a class="reference internal" href="#IPython.lib.demo.Demo" title="IPython.lib.demo.Demo"><tt class="xref py py-class docutils literal"><span class="pre">IPython.lib.demo.Demo</span></tt></a></p>
</dd></dl>

<dl class="class">
<dt id="IPython.lib.demo.ClearIPDemo">
<em class="property">class </em><tt class="descclassname">IPython.lib.demo.</tt><tt class="descname">ClearIPDemo</tt><big>(</big><em>src</em>, <em>title=u''</em>, <em>arg_str=u''</em>, <em>auto_all=None</em><big>)</big><a class="headerlink" href="#IPython.lib.demo.ClearIPDemo" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#IPython.lib.demo.ClearMixin" title="IPython.lib.demo.ClearMixin"><tt class="xref py py-class docutils literal"><span class="pre">IPython.lib.demo.ClearMixin</span></tt></a>, <a class="reference internal" href="#IPython.lib.demo.IPythonDemo" title="IPython.lib.demo.IPythonDemo"><tt class="xref py py-class docutils literal"><span class="pre">IPython.lib.demo.IPythonDemo</span></tt></a></p>
</dd></dl>

</div>
<div class="section" id="function">
<h2>1 Function<a class="headerlink" href="#function" title="Permalink to this headline">¶</a></h2>
<dl class="function">
<dt id="IPython.lib.demo.re_mark">
<tt class="descclassname">IPython.lib.demo.</tt><tt class="descname">re_mark</tt><big>(</big><em>mark</em><big>)</big><a class="headerlink" href="#IPython.lib.demo.re_mark" title="Permalink to this definition">¶</a></dt>
<dd></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.lib.display.html" title="Module: lib.display"
             >next</a> |</li>
        <li class="right" >
          <a href="IPython.lib.deepreload.html" title="Module: lib.deepreload"
             >previous</a> |</li>
        <li><a href="http://ipython.org">home</a>|&nbsp;</li>
        <li><a href="../../search.html">search</a>|&nbsp;</li>
       <li><a href="../../index.html">documentation </a> &raquo;</li>

          <li><a href="../index.html" >The IPython API</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
        &copy; 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>