Trees | Index | Help |
---|
Package Bio :: Module ParserSupport |
|
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
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.Classes | |
---|---|
AbstractConsumer |
Base class for other Consumers. |
AbstractParser |
Base class for other parsers. |
EventGenerator |
Handler to generate events associated with a Martel parsed file. |
SGMLStrippingConsumer |
A consumer that strips off SGML tags. |
TaggingConsumer |
A Consumer that tags the data stream with the event and prints it to a handle. |
Function Summary | |
---|---|
attempt_read_and_call(uhandle, method, **keywds) -> boolean | |
is_blank_line(line, allow_spaces=0) -> boolean | |
read_and_call(uhandle, method[, start][, end][, contains][, blank][, has_re]) | |
read_and_call_until(uhandle, method, start=None, end=None, contains=None, blank=None) -> number of lines | |
read_and_call_while(uhandle, method[, start][, end][, contains][, blank][, has_re]) -> number of lines | |
safe_peekline(handle) -> line | |
safe_readline(handle) -> line |
Function Details |
---|
attempt_read_and_call(uhandle, method, **keywds)attempt_read_and_call(uhandle, method, **keywds) -> boolean Similar to read_and_call, but returns a boolean specifying whether the line has passed the checks. Does not raise exceptions. See docs for read_and_call for a description of the function arguments. |
is_blank_line(line, allow_spaces=0)is_blank_line(line, allow_spaces=0) -> boolean 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. |
read_and_call(uhandle, method, **keywds)read_and_call(uhandle, method[, start][, end][, contains][, blank][, has_re]) Read a line from uhandle, check it, and pass it to the method. Raises a SyntaxError if the line does not pass the checks. 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. |
read_and_call_until(uhandle, method, **keywds)read_and_call_until(uhandle, method, start=None, end=None, contains=None, blank=None) -> number of lines Read a line from uhandle and pass it to the method until some condition is true. Returns the number of lines that were read. See the docstring for read_and_call for a description of the parameters. |
read_and_call_while(uhandle, method, **keywds)read_and_call_while(uhandle, method[, start][, end][, contains][, blank][, has_re]) -> number of lines 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. See the docstring for read_and_call for a description of the parameters. |
safe_peekline(handle)safe_peekline(handle) -> line Peek at the next line in an UndoHandle and return it. If there are no more lines to peek, I will raise a SyntaxError. |
safe_readline(handle)safe_readline(handle) -> line Read a line from an UndoHandle and return it. If there are no more lines to read, I will raise a SyntaxError. |
Trees | Index | Help |
---|
Generated by Epydoc 2.1 on Mon Aug 27 16:12:10 2007 | http://epydoc.sf.net |