1. Atsushi Odagiri
  2. aodag.bitbucket.org

Source

aodag.bitbucket.org / meta_class.html

<!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>Pythonのメタクラスについて &mdash; aodag documents v0.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:     '0.0',
        COLLAPSE_MODINDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="_static/jquery.js"></script>
    <script type="text/javascript" src="_static/doctools.js"></script>
    <link rel="top" title="aodag documents v0.0 documentation" href="index.html" /> 
  </head>
  <body>
    <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><a href="index.html">aodag documents v0.0 documentation</a> &raquo;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="python">
<h1>Pythonのメタクラスについて<a class="headerlink" href="#python" title="Permalink to this headline"></a></h1>
<p>最近どっかでメタプログラミングが流行っているようなので、Pythonでもひとつ。</p>
<div class="section" id="class-object">
<h2><cite>class</cite><cite>object</cite><a class="headerlink" href="#class-object" title="Permalink to this headline"></a></h2>
<p>一番単純な例として、classもオブジェクトであるということ。</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="k">class</span> <span class="nc">A</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
<span class="gp">... </span>    <span class="sd">&quot;&quot;&quot; A sample class &quot;&quot;&quot;</span>
<span class="gp">...</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">A</span>
<span class="go">&lt;class &#39;A&#39;&gt;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">AA</span> <span class="o">=</span> <span class="n">A</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">a</span> <span class="o">=</span> <span class="n">A</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="nb">isinstance</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">A</span><span class="p">)</span>
<span class="go">True</span>
</pre></div>
</div>
<p><cite>A</cite> はクラスであり、オブジェクトでもある。
<cite>A</cite><cite>class</cite> 文で作成されているわけで、 <cite>class</cite> 文というのは、クラスを作成するための文ということだ。</p>
<p>さて、ここで <cite>A</cite> の型はなんであろう。</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="nb">type</span><span class="p">(</span><span class="n">a</span><span class="p">)</span>
<span class="go">&lt;class &#39;A&#39;&gt;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">A</span>
<span class="go">&lt;class &#39;A&#39;&gt;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="nb">type</span><span class="p">(</span><span class="n">A</span><span class="p">)</span>
<span class="go">&lt;type &#39;type&#39;&gt;</span>
</pre></div>
</div>
<p><cite>A</cite> の型は <cite>type</cite> である。
<cite>A</cite> は、 <cite>type</cite> のインスタンスと言い換えられる。</p>
<p>さらに、 <cite>type</cite> は、クラスのコンストラクタとして利用できる。</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">MyPerson</span> <span class="o">=</span> <span class="nb">type</span><span class="p">(</span><span class="s">&#39;MyPerson&#39;</span><span class="p">,</span> <span class="p">(</span><span class="nb">object</span><span class="p">,),</span> <span class="p">{})</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">MyPerson</span>
<span class="go">&lt;class &#39;MyPerson&#39;&gt;</span>
</pre></div>
</div>
<p>この呼び出しは以下の <cite>class</cite> 定義文と同等である。</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="k">class</span> <span class="nc">MyPerson</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
<span class="gp">... </span>    <span class="k">pass</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">MyPerson</span>
<span class="go">&lt;class &#39;MyPerson&#39;&gt;</span>
</pre></div>
</div>
<p>つまり、 <cite>class</cite> 文とは、 type(name, bases, dct) 呼び出しのシンタックスシュガーと言える。</p>
</div>
<div class="section" id="id1">
<h2>メタクラスの継承<a class="headerlink" href="#id1" title="Permalink to this headline"></a></h2>
<p><cite>type</cite> の、 <cite>type</cite> は、 <cite>type</cite> となっている。</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="nb">type</span><span class="p">(</span><span class="nb">type</span><span class="p">)</span>
<span class="go">&lt;type &#39;type&#39;&gt;</span>
</pre></div>
</div>
<p>また、 <cite>type</cite> を親クラスとして、 <cite>class</cite> 宣言可能である。</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="k">class</span> <span class="nc">MyType</span><span class="p">(</span><span class="nb">type</span><span class="p">):</span>
<span class="gp">... </span>    <span class="k">pass</span>
<span class="gp">...</span>
</pre></div>
</div>
<p><cite>type</cite> のサブクラス <cite>MyType</cite> を使って、クラスを生成できる。</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">MyType</span><span class="p">(</span><span class="s">&#39;MyTypedPerson&#39;</span><span class="p">,</span> <span class="p">(</span><span class="nb">object</span><span class="p">,),</span> <span class="p">{})</span>
<span class="go">&lt;class &#39;MyTypedPerson&#39;&gt;</span>
</pre></div>
</div>
<p>このままでは、特に何も変わらない。
クラス生成時にいくつかの処理を付け加えよう。</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="k">class</span> <span class="nc">MyType</span><span class="p">(</span><span class="nb">type</span><span class="p">):</span>
<span class="gp">... </span>    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="n">cls</span><span class="p">,</span> <span class="n">name</span><span class="p">,</span> <span class="n">bases</span><span class="p">,</span> <span class="n">dct</span><span class="p">):</span>
<span class="gp">... </span>        <span class="nb">super</span><span class="p">(</span><span class="n">MyType</span><span class="p">,</span> <span class="n">cls</span><span class="p">)</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">bases</span><span class="p">,</span> <span class="n">dct</span><span class="p">)</span>
<span class="gp">... </span>        <span class="k">if</span> <span class="s">&#39;message&#39;</span> <span class="ow">in</span> <span class="n">dct</span><span class="p">:</span>
<span class="gp">... </span>            <span class="k">print</span> <span class="n">dct</span><span class="p">[</span><span class="s">&#39;message&#39;</span><span class="p">]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">MyTypedPerson</span> <span class="o">=</span> <span class="n">MyType</span><span class="p">(</span><span class="s">&#39;MyTypedPerson&#39;</span><span class="p">,</span> <span class="p">(</span><span class="nb">object</span><span class="p">,),</span> <span class="p">{</span><span class="s">&#39;message&#39;</span><span class="p">:</span><span class="s">&#39;hello&#39;</span><span class="p">})</span>
<span class="go">hello</span>
</pre></div>
</div>
<p>さらにクラス定義に変更を加えてみよう。</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="k">class</span> <span class="nc">MyType2</span><span class="p">(</span><span class="nb">type</span><span class="p">):</span>
<span class="gp">... </span>    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="n">cls</span><span class="p">,</span> <span class="n">name</span><span class="p">,</span> <span class="n">bases</span><span class="p">,</span> <span class="n">dct</span><span class="p">):</span>
<span class="gp">... </span>        <span class="nb">super</span><span class="p">(</span><span class="n">MyType2</span><span class="p">,</span> <span class="n">cls</span><span class="p">)</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">bases</span><span class="p">,</span> <span class="n">dct</span><span class="p">)</span>
<span class="gp">... </span>        <span class="k">def</span> <span class="nf">new_init</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
<span class="gp">... </span>            <span class="k">for</span> <span class="n">k</span><span class="p">,</span> <span class="n">v</span> <span class="ow">in</span> <span class="p">[(</span><span class="n">k</span><span class="p">,</span> <span class="n">v</span><span class="p">)</span> <span class="k">for</span> <span class="p">(</span><span class="n">k</span><span class="p">,</span> <span class="n">v</span><span class="p">)</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">iteritems</span><span class="p">()</span> <span class="k">if</span> <span class="n">k</span> <span class="ow">in</span> <span class="n">dct</span><span class="p">[</span><span class="s">&#39;attributes&#39;</span><span class="p">]]:</span>
<span class="gp">... </span>                <span class="nb">setattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">k</span><span class="p">,</span> <span class="n">v</span><span class="p">)</span>
<span class="gp">... </span>        <span class="n">cls</span><span class="o">.</span><span class="n">__init__</span> <span class="o">=</span> <span class="n">new_init</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">MyTypedPerson2</span> <span class="o">=</span> <span class="n">MyType2</span><span class="p">(</span><span class="s">&#39;MyTypedPerson&#39;</span><span class="p">,</span> <span class="p">(</span><span class="nb">object</span><span class="p">,),</span> <span class="p">{</span><span class="s">&#39;attributes&#39;</span><span class="p">:[</span><span class="s">&#39;name&#39;</span><span class="p">,</span> <span class="s">&#39;description&#39;</span><span class="p">]})</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p2</span> <span class="o">=</span> <span class="n">MyTypedPerson2</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="s">&#39;aodag&#39;</span><span class="p">,</span> <span class="n">description</span><span class="o">=</span><span class="s">&#39;author of this document&#39;</span><span class="p">,</span> <span class="n">other</span><span class="o">=</span><span class="s">&#39;ignore this argument&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p2</span><span class="o">.</span><span class="n">name</span><span class="p">,</span> <span class="n">p2</span><span class="o">.</span><span class="n">description</span>
<span class="go">(&#39;aodag&#39;, &#39;author of this document&#39;)</span>
</pre></div>
</div>
<p>これは、指定したアトリビュートを受け取るコンストラクタを生成する。</p>
<p><cite>class</cite> 文でメタクラスを使う場合は以下のように宣言する。</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="k">class</span> <span class="nc">MyTypedPerson3</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
<span class="gp">... </span>    <span class="n">__metaclass__</span> <span class="o">=</span> <span class="n">MyType2</span>
<span class="gp">...</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p3</span> <span class="o">=</span> <span class="n">MyTypedPerson2</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="s">&#39;aodag&#39;</span><span class="p">,</span> <span class="n">description</span><span class="o">=</span><span class="s">&#39;author of this document&#39;</span><span class="p">,</span> <span class="n">other</span><span class="o">=</span><span class="s">&#39;ignore this argument&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p3</span><span class="o">.</span><span class="n">name</span><span class="p">,</span> <span class="n">p2</span><span class="o">.</span><span class="n">description</span>
<span class="go">(&#39;aodag&#39;, &#39;author of this document&#39;)</span>
</pre></div>
</div>
</div>
<div class="section" id="sql">
<h2>ケーススタディ SQLメソッド<a class="headerlink" href="#sql" title="Permalink to this headline"></a></h2>
<p>メタクラスによるメソッド生成の例として、SQLメソッドを作成する。
これから作成するメタクラスは、クラス宣言中の文字列をSQLとして実行するメソッドに変換する。</p>
<p>まず下準備</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">sqlite3</span> <span class="kn">as</span> <span class="nn">db</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">con</span> <span class="o">=</span> <span class="n">db</span><span class="o">.</span><span class="n">connect</span><span class="p">(</span><span class="s">&#39;:memory:&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">c</span> <span class="o">=</span> <span class="n">con</span><span class="o">.</span><span class="n">cursor</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">c</span> <span class="o">=</span> <span class="n">c</span><span class="o">.</span><span class="n">execute</span><span class="p">(</span><span class="s">&quot;&quot;&quot;</span>
<span class="gp">... </span><span class="s"> CREATE TABLE person</span>
<span class="gp">... </span><span class="s"> (</span>
<span class="gp">... </span><span class="s">      person_id INTEGER PRIMARY KEY,</span>
<span class="gp">... </span><span class="s">      name varchar(255)</span>
<span class="gp">... </span><span class="s"> )</span>
<span class="gp">... </span><span class="s">&quot;&quot;&quot;</span><span class="p">)</span>
<span class="gp">...</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">c</span> <span class="o">=</span> <span class="n">c</span><span class="o">.</span><span class="n">execute</span><span class="p">(</span><span class="s">&quot;&quot;&quot;</span>
<span class="gp">... </span><span class="s"> INSERT INTO person</span>
<span class="gp">... </span><span class="s"> (</span>
<span class="gp">... </span><span class="s">   name</span>
<span class="gp">... </span><span class="s"> )</span>
<span class="gp">... </span><span class="s"> VALUES</span>
<span class="gp">... </span><span class="s"> (</span>
<span class="gp">... </span><span class="s">   &#39;aodag&#39;</span>
<span class="gp">... </span><span class="s"> )</span>
<span class="gp">... </span><span class="s">&quot;&quot;&quot;</span><span class="p">)</span>
<span class="gp">... </span><span class="n">c</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
<p>以下がSQLメソッド生成をするメタクラスである。
また、コネクションを受け取るコンストラクタも生成している。</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="k">class</span> <span class="nc">SQLQueryType</span><span class="p">(</span><span class="nb">type</span><span class="p">):</span>
<span class="gp">... </span>    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="n">cls</span><span class="p">,</span> <span class="n">name</span><span class="p">,</span> <span class="n">bases</span><span class="p">,</span> <span class="n">dct</span><span class="p">):</span>
<span class="gp">... </span>        <span class="nb">super</span><span class="p">(</span><span class="n">SQLQueryType</span><span class="p">,</span> <span class="n">cls</span><span class="p">)</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">bases</span><span class="p">,</span> <span class="n">dct</span><span class="p">)</span>
<span class="gp">... </span>        <span class="k">for</span> <span class="n">k</span><span class="p">,</span> <span class="n">v</span> <span class="ow">in</span> <span class="p">[(</span><span class="n">k</span><span class="p">,</span> <span class="n">v</span><span class="p">)</span> <span class="k">for</span> <span class="p">(</span><span class="n">k</span><span class="p">,</span> <span class="n">v</span><span class="p">)</span> <span class="ow">in</span> <span class="n">dct</span><span class="o">.</span><span class="n">iteritems</span><span class="p">()</span> <span class="k">if</span> <span class="ow">not</span> <span class="n">k</span><span class="o">.</span><span class="n">startswith</span><span class="p">(</span><span class="s">&#39;_&#39;</span><span class="p">)</span> <span class="ow">and</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">v</span><span class="p">,</span> <span class="nb">basestring</span><span class="p">)]:</span>
<span class="gp">... </span>            <span class="nb">setattr</span><span class="p">(</span><span class="n">cls</span><span class="p">,</span> <span class="n">k</span><span class="p">,</span> <span class="n">cls</span><span class="o">.</span><span class="n">sqlmethod</span><span class="p">(</span><span class="n">v</span><span class="p">))</span>
<span class="gp">... </span>        <span class="n">cls</span><span class="o">.</span><span class="n">__init__</span> <span class="o">=</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">con</span><span class="p">:</span> <span class="nb">setattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="s">&#39;connection&#39;</span><span class="p">,</span> <span class="n">con</span><span class="p">)</span>
<span class="gp">...</span>
<span class="gp">... </span>    <span class="k">def</span> <span class="nf">sqlmethod</span><span class="p">(</span><span class="n">cls</span><span class="p">,</span> <span class="n">sql</span><span class="p">):</span>
<span class="gp">... </span>        <span class="k">def</span> <span class="nf">method</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">):</span>
<span class="gp">... </span>            <span class="n">cur</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">connection</span><span class="o">.</span><span class="n">cursor</span><span class="p">()</span>
<span class="gp">... </span>            <span class="k">try</span><span class="p">:</span>
<span class="gp">... </span>                <span class="n">cur</span><span class="o">.</span><span class="n">execute</span><span class="p">(</span><span class="n">sql</span><span class="p">,</span> <span class="nb">tuple</span><span class="p">(</span><span class="n">args</span><span class="p">))</span>
<span class="gp">... </span>                <span class="k">return</span> <span class="n">cur</span><span class="o">.</span><span class="n">fetchall</span><span class="p">()</span>
<span class="gp">... </span>            <span class="k">finally</span><span class="p">:</span>
<span class="gp">... </span>                <span class="n">cur</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
<span class="gp">... </span>        <span class="k">return</span> <span class="n">method</span>
<span class="gp">...</span>
</pre></div>
</div>
<p>クラス宣言中のアトリビュートから、文字列のものを選択し、`sqlmethod` メソッドで、実際にSQLを実行するためのメソッドを生成している。
<cite>_</cite> で始まる名前は対象外にするのは、礼儀として重要だ。</p>
<p>この、 <cite>SQLQueryType</cite> は以下のように使う。</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="k">class</span> <span class="nc">MyQuery</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
<span class="gp">... </span>     <span class="n">__metaclass__</span> <span class="o">=</span> <span class="n">SQLQueryType</span>
<span class="gp">... </span>     <span class="n">select_all</span> <span class="o">=</span> <span class="s">&quot;SELECT * FROM person&quot;</span>
<span class="gp">... </span>     <span class="n">insert_new</span> <span class="o">=</span> <span class="s">&quot;INSERT INTO person (name) VALUES (?)&quot;</span>
<span class="gp">... </span>     <span class="n">update</span> <span class="o">=</span> <span class="s">&quot;UPDATE person SET name = ? WHERE person_id = ?&quot;</span>
<span class="gp">...</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">q</span> <span class="o">=</span> <span class="n">MyQuery</span><span class="p">(</span><span class="n">con</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">q</span><span class="o">.</span><span class="n">select_all</span><span class="p">()</span>
<span class="go">[(1, u&#39;aodag&#39;)]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">q</span><span class="o">.</span><span class="n">insert_new</span><span class="p">(</span><span class="s">&#39;John Doe&#39;</span><span class="p">)</span>
<span class="go">[]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">q</span><span class="o">.</span><span class="n">select_all</span><span class="p">()</span>
<span class="go">[(1, u&#39;aodag&#39;), (2, u&#39;John Doe&#39;)]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">q</span><span class="o">.</span><span class="n">update</span><span class="p">(</span><span class="s">&#39;aodagx&#39;</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
<span class="go">[]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">q</span><span class="o">.</span><span class="n">select_all</span><span class="p">()</span>
<span class="go">[(1, u&#39;aodagx&#39;), (2, u&#39;John Doe&#39;)]</span>
</pre></div>
</div>
</div>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
            <h3><a href="index.html">Table Of Contents</a></h3>
            <ul>
<li><a class="reference external" href="#">Pythonのメタクラスについて</a><ul>
<li><a class="reference external" href="#class-object"><cite>class</cite><cite>object</cite></a></li>
<li><a class="reference external" href="#id1">メタクラスの継承</a></li>
<li><a class="reference external" href="#sql">ケーススタディ SQLメソッド</a></li>
</ul>
</li>
</ul>

            <h3>This Page</h3>
            <ul class="this-page-menu">
              <li><a href="_sources/meta_class.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" size="18" />
                <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="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><a href="index.html">aodag documents v0.0 documentation</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
      &copy; Copyright 2010, Atsushi Odagiri.
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.4.
    </div>
  </body>
</html>