<a name="L6"></a><tt class="py-lineno"> 6</tt> <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment"># This program is free software; you can redistribute it and/or</tt> </tt>
<a name="L7"></a><tt class="py-lineno"> 7</tt> <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment"># modify it under the terms of the GNU General Public License</tt> </tt>
<a name="L8"></a><tt class="py-lineno"> 8</tt> <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment"># as published by the Free Software Foundation; either version 2 </tt> </tt>
<a name="L9"></a><tt class="py-lineno"> 9</tt> <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment"># of the License, or (at your option) any later version.</tt> </tt>
<a name="L11"></a><tt class="py-lineno"> 11</tt> <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment"># This program is distributed in the hope that it will be useful,</tt> </tt>
<a name="L12"></a><tt class="py-lineno"> 12</tt> <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment"># but WITHOUT ANY WARRANTY; without even the implied warranty of</tt> </tt>
<a name="L13"></a><tt class="py-lineno"> 13</tt> <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment"># MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</tt> </tt>
<a name="L14"></a><tt class="py-lineno"> 14</tt> <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment"># GNU General Public License for more details. </tt> </tt>
<a name="L16"></a><tt class="py-lineno"> 16</tt> <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment"># You should have received a copy of the GNU General Public License</tt> </tt>
<a name="L17"></a><tt class="py-lineno"> 17</tt> <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment"># along with this program; if not, write to the Free Software</tt> </tt>
<a name="L18"></a><tt class="py-lineno"> 18</tt> <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment"># Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.</tt> </tt>
<a name="L24"></a><tt class="py-lineno"> 24</tt> <tt class="py-line"><tt class="py-docstring">Given a database in, say, PubMed format, it is possible to plug an</tt> </tt>
<a name="L25"></a><tt class="py-lineno"> 25</tt> <tt class="py-line"><tt class="py-docstring">adapter on top of it so that it looks as if the database is in, say,</tt> </tt>
<a name="L26"></a><tt class="py-lineno"> 26</tt> <tt class="py-line"><tt class="py-docstring">BibTeX format instead.</tt> </tt>
<a name="L38"></a><tt class="py-lineno"> 38</tt> <tt class="py-line"> <tt class="py-docstring">""" This class is a db built on top of another db, which behaves</tt> </tt>
<a name="L39"></a><tt class="py-lineno"> 39</tt> <tt class="py-line"><tt class="py-docstring"> as if it were of a different schema."""</tt> </tt>
</div><div id="OneToOneAdapter-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="OneToOneAdapter-expanded"><a name="L97"></a><tt class="py-lineno"> 97</tt> <tt class="py-line"> <tt class="py-docstring">""" This adapter assumes a one-to-one mapping between the source</tt> </tt>
<a name="L98"></a><tt class="py-lineno"> 98</tt> <tt class="py-line"><tt class="py-docstring"> and the target databases. The keys are not modified. """</tt> </tt>
</div><div id="OneToOneAdapter.source2target-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="OneToOneAdapter.source2target-expanded"><a name="L105"></a><tt class="py-lineno">105</tt> <tt class="py-line"> <tt class="py-docstring">""" Translates a record from the source db to the target db """</tt> </tt>
</div><div id="OneToOneAdapter.target2source-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="OneToOneAdapter.target2source-expanded"><a name="L109"></a><tt class="py-lineno">109</tt> <tt class="py-line"> <tt class="py-docstring">""" Translates a record from the target db to the source db """</tt> </tt>
</div><div id="adapt_schema-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="adapt_schema-expanded"><a name="L145"></a><tt class="py-lineno">145</tt> <tt class="py-line"> <tt class="py-docstring">""" Returns a database using the specified 'target_schema', and</tt> </tt>
<a name="L146"></a><tt class="py-lineno">146</tt> <tt class="py-line"><tt class="py-docstring"> that maps the content of 'db', thanks to one or more</tt> </tt>
<a name="L147"></a><tt class="py-lineno">147</tt> <tt class="py-line"><tt class="py-docstring"> L{Adapter}s. If no suitable adapter can be found, will raise an</tt> </tt>
<a name="L150"></a><tt class="py-lineno">150</tt> <tt class="py-line"> <tt class="py-comment"># for the moment, we only resolve direct hits. More clever</tt> </tt>
<a name="L151"></a><tt class="py-lineno">151</tt> <tt class="py-line"><tt class="py-comment"></tt> <tt class="py-comment"># resolutions will hopefully be implemented.</tt> </tt>
<a name="L156"></a><tt class="py-lineno">156</tt> <tt class="py-line"> <tt class="py-comment"># search for target_schema in the adapters for the current schema:</tt> </tt>