Sophie

Sophie

distrib > * > cooker > x86_64 > by-pkgid > 635dc0b7819f4e396a16d64269572c71 > files > 737

biopython-doc-1.58-1.x86_64.rpm

<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Bio.ParserSupport</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />
  <script type="text/javascript" src="epydoc.js"></script>
</head>

<body bgcolor="white" text="black" link="blue" vlink="#204080"
      alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

      <th class="navbar" width="100%"></th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <span class="breadcrumbs">
        <a href="Bio-module.html">Package&nbsp;Bio</a> ::
        Module&nbsp;ParserSupport
      </span>
    </td>
    <td>
      <table cellpadding="0" cellspacing="0">
        <!-- hide/show private -->
        <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
    onclick="toggle_private();">hide&nbsp;private</a>]</span></td></tr>
        <tr><td align="right"><span class="options"
            >[<a href="frames.html" target="_top">frames</a
            >]&nbsp;|&nbsp;<a href="Bio.ParserSupport-module.html"
            target="_top">no&nbsp;frames</a>]</span></td></tr>
      </table>
    </td>
  </tr>
</table>
<!-- ==================== MODULE DESCRIPTION ==================== -->
<h1 class="epydoc">Module ParserSupport</h1><p class="nomargin-top"><span class="codelink"><a href="Bio.ParserSupport-pysrc.html">source&nbsp;code</a></span></p>
<pre class="literalblock">
Code to support writing parsers.



Classes:
AbstractParser         Base class for parsers.
AbstractConsumer       Base class of all Consumers.
TaggingConsumer        Consumer that tags output with its event.  For debugging
SGMLStrippingConsumer  Consumer that strips SGML tags from output.
EventGenerator         Generate Biopython Events from Martel XML output
                       (note that Martel is now DEPRECATED)

Functions:
safe_readline          Read a line from a handle, with check for EOF.
safe_peekline          Peek at next line, with check for EOF.
read_and_call          Read a line from a handle and pass it to a method.
read_and_call_while    Read many lines, as long as a condition is met.
read_and_call_until    Read many lines, until a condition is met.
attempt_read_and_call  Like read_and_call, but forgiving of errors.
is_blank_line          Test whether a line is blank.

</pre>

<!-- ==================== CLASSES ==================== -->
<a name="section-Classes"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Classes</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-Classes"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="Bio.ParserSupport.AbstractParser-class.html" class="summary-name">AbstractParser</a><br />
      Base class for other parsers.
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="Bio.ParserSupport.AbstractConsumer-class.html" class="summary-name">AbstractConsumer</a><br />
      Base class for other Consumers.
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="Bio.ParserSupport.TaggingConsumer-class.html" class="summary-name">TaggingConsumer</a><br />
      A Consumer that tags the data stream with the event and prints it 
        to a handle.
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="Bio.ParserSupport.SGMLStrippingConsumer-class.html" class="summary-name">SGMLStrippingConsumer</a><br />
      A consumer that strips off SGML tags.
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="Bio.ParserSupport.EventGenerator-class.html" class="summary-name">EventGenerator</a><br />
      Handler to generate events associated with a Martel parsed file.
    </td>
  </tr>
</table>
<!-- ==================== FUNCTIONS ==================== -->
<a name="section-Functions"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Functions</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-Functions"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Bio.ParserSupport-module.html#read_and_call" class="summary-sig-name">read_and_call</a>(<span class="summary-sig-arg">uhandle</span>,
        <span class="summary-sig-arg">method</span>,
        <span class="summary-sig-arg">**keywds</span>)</span><br />
      read_and_call(uhandle, method[, start][, end][, contains][, blank][, 
      has_re])</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Bio.ParserSupport-pysrc.html#read_and_call">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Bio.ParserSupport-module.html#read_and_call_while" class="summary-sig-name">read_and_call_while</a>(<span class="summary-sig-arg">uhandle</span>,
        <span class="summary-sig-arg">method</span>,
        <span class="summary-sig-arg">**keywds</span>)</span><br />
      read_and_call_while(uhandle, method[, start][, end][, contains][, 
      blank][, has_re]) -&gt; number of lines</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Bio.ParserSupport-pysrc.html#read_and_call_while">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">number of lines</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Bio.ParserSupport-module.html#read_and_call_until" class="summary-sig-name">read_and_call_until</a>(<span class="summary-sig-arg">uhandle</span>,
        <span class="summary-sig-arg">method</span>,
        <span class="summary-sig-arg">start</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">end</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">contains</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">blank</span>=<span class="summary-sig-default">None</span>)</span><br />
      Read a line from uhandle and pass it to the method until some 
      condition is true.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Bio.ParserSupport-pysrc.html#read_and_call_until">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">boolean</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Bio.ParserSupport-module.html#attempt_read_and_call" class="summary-sig-name">attempt_read_and_call</a>(<span class="summary-sig-arg">uhandle</span>,
        <span class="summary-sig-arg">method</span>,
        <span class="summary-sig-arg">**keywds</span>)</span><br />
      Similar to read_and_call, but returns a boolean specifying whether 
      the line has passed the checks.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Bio.ParserSupport-pysrc.html#attempt_read_and_call">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="_fails_conditions"></a><span class="summary-sig-name">_fails_conditions</span>(<span class="summary-sig-arg">line</span>,
        <span class="summary-sig-arg">start</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">end</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">contains</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">blank</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">has_re</span>=<span class="summary-sig-default">None</span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Bio.ParserSupport-pysrc.html#_fails_conditions">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">boolean</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Bio.ParserSupport-module.html#is_blank_line" class="summary-sig-name">is_blank_line</a>(<span class="summary-sig-arg">line</span>,
        <span class="summary-sig-arg">allow_spaces</span>=<span class="summary-sig-default">0</span>)</span><br />
      Return whether a line is blank.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Bio.ParserSupport-pysrc.html#is_blank_line">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">line</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Bio.ParserSupport-module.html#safe_readline" class="summary-sig-name">safe_readline</a>(<span class="summary-sig-arg">handle</span>)</span><br />
      Read a line from an UndoHandle and return it.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Bio.ParserSupport-pysrc.html#safe_readline">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">line</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Bio.ParserSupport-module.html#safe_peekline" class="summary-sig-name">safe_peekline</a>(<span class="summary-sig-arg">handle</span>)</span><br />
      Peek at the next line in an UndoHandle and return it.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Bio.ParserSupport-pysrc.html#safe_peekline">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
</table>
<!-- ==================== VARIABLES ==================== -->
<a name="section-Variables"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Variables</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-Variables"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a name="xml_support"></a><span class="summary-name">xml_support</span> = <code title="1">1</code>
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a name="__package__"></a><span class="summary-name">__package__</span> = <code title="'Bio'"><code class="variable-quote">'</code><code class="variable-string">Bio</code><code class="variable-quote">'</code></code>
    </td>
  </tr>
</table>
<!-- ==================== FUNCTION DETAILS ==================== -->
<a name="section-FunctionDetails"></a>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Function Details</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-FunctionDetails"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
</table>
<a name="read_and_call"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">read_and_call</span>(<span class="sig-arg">uhandle</span>,
        <span class="sig-arg">method</span>,
        <span class="sig-arg">**keywds</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Bio.ParserSupport-pysrc.html#read_and_call">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>read_and_call(uhandle, method[, start][, end][, contains][, blank][, 
  has_re])</p>
  <p>Read a line from uhandle, check it, and pass it to the method. Raises 
  a ValueError if the line does not pass the checks.</p>
  <p>start, end, contains, blank, and has_re specify optional conditions 
  that the line must pass.  start and end specifies what the line must 
  begin or end with (not counting EOL characters).  contains specifies a 
  substring that must be found in the line.  If blank is a true value, then
  the line must be blank.  has_re should be a regular expression object 
  with a pattern that the line must match somewhere.</p>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="read_and_call_while"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">read_and_call_while</span>(<span class="sig-arg">uhandle</span>,
        <span class="sig-arg">method</span>,
        <span class="sig-arg">**keywds</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Bio.ParserSupport-pysrc.html#read_and_call_while">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>read_and_call_while(uhandle, method[, start][, end][, contains][, 
  blank][, has_re]) -&gt; number of lines</p>
  <p>Read a line from uhandle and pass it to the method as long as some 
  condition is true.  Returns the number of lines that were read.</p>
  <p>See the docstring for read_and_call for a description of the 
  parameters.</p>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="read_and_call_until"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">read_and_call_until</span>(<span class="sig-arg">uhandle</span>,
        <span class="sig-arg">method</span>,
        <span class="sig-arg">start</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">end</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">contains</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">blank</span>=<span class="sig-default">None</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Bio.ParserSupport-pysrc.html#read_and_call_until">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Read a line from uhandle and pass it to the method until some 
  condition is true.  Returns the number of lines that were read.</p>
  <p>See the docstring for read_and_call for a description of the 
  parameters.</p>
  <dl class="fields">
    <dt>Returns: number of lines</dt>
  </dl>
</td></tr></table>
</div>
<a name="attempt_read_and_call"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">attempt_read_and_call</span>(<span class="sig-arg">uhandle</span>,
        <span class="sig-arg">method</span>,
        <span class="sig-arg">**keywds</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Bio.ParserSupport-pysrc.html#attempt_read_and_call">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Similar to read_and_call, but returns a boolean specifying whether the
  line has passed the checks.  Does not raise exceptions.</p>
  <p>See docs for read_and_call for a description of the function 
  arguments.</p>
  <dl class="fields">
    <dt>Returns: boolean</dt>
  </dl>
</td></tr></table>
</div>
<a name="is_blank_line"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">is_blank_line</span>(<span class="sig-arg">line</span>,
        <span class="sig-arg">allow_spaces</span>=<span class="sig-default">0</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Bio.ParserSupport-pysrc.html#is_blank_line">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Return whether a line is blank.  allow_spaces specifies whether to 
  allow whitespaces in a blank line.  A true value signifies that a line 
  containing whitespaces as well as end-of-line characters should be 
  considered blank.</p>
  <dl class="fields">
    <dt>Returns: boolean</dt>
  </dl>
</td></tr></table>
</div>
<a name="safe_readline"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">safe_readline</span>(<span class="sig-arg">handle</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Bio.ParserSupport-pysrc.html#safe_readline">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Read a line from an UndoHandle and return it.  If there are no more 
  lines to read, I will raise a ValueError.</p>
  <dl class="fields">
    <dt>Returns: line</dt>
  </dl>
</td></tr></table>
</div>
<a name="safe_peekline"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">safe_peekline</span>(<span class="sig-arg">handle</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Bio.ParserSupport-pysrc.html#safe_peekline">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Peek at the next line in an UndoHandle and return it.  If there are no
  more lines to peek, I will raise a ValueError.</p>
  <dl class="fields">
    <dt>Returns: line</dt>
  </dl>
</td></tr></table>
</div>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

      <th class="navbar" width="100%"></th>
  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
  <tr>
    <td align="left" class="footer">
    Generated by Epydoc 3.0.1 on Thu Aug 18 18:19:21 2011
    </td>
    <td align="right" class="footer">
      <a target="mainFrame" href="http://epydoc.sourceforge.net"
        >http://epydoc.sourceforge.net</a>
    </td>
  </tr>
</table>

<script type="text/javascript">
  <!--
  // Private objects are initially displayed (because if
  // javascript is turned off then we want them to be
  // visible); but by default, we want to hide them.  So hide
  // them unless we have a cookie that says to show them.
  checkCookie();
  // -->
</script>
</body>
</html>