Package Bio :: Module ParserSupport
[hide private]
[frames] | no frames]

Module ParserSupport

source code

Code to support writing parsers (DEPRECATED).

Classes:

Functions:

Classes [hide private]
  AbstractParser
Base class for other parsers.
  AbstractConsumer
Base class for other Consumers.
  TaggingConsumer
A Consumer that tags the data stream with the event and prints it to a handle.
  EventGenerator
Handler to generate events associated with a Martel parsed file.
Functions [hide private]
 
read_and_call(uhandle, method, **keywds)
read_and_call(uhandle, method[, start][, end][, contains][, blank][, has_re])
source code
 
read_and_call_while(uhandle, method, **keywds)
read_and_call_while(uhandle, method[, start][, end][, contains][, blank][, has_re]) -> number of lines
source code
number of lines
read_and_call_until(uhandle, method, start=None, end=None, contains=None, blank=None)
Read a line from uhandle and pass it to the method until some condition is true.
source code
boolean
attempt_read_and_call(uhandle, method, **keywds)
Similar to read_and_call, but returns a boolean specifying whether the line has passed the checks.
source code
 
_fails_conditions(line, start=None, end=None, contains=None, blank=None, has_re=None) source code
boolean
is_blank_line(line, allow_spaces=0)
Return whether a line is blank.
source code
line
safe_readline(handle)
Read a line from an UndoHandle and return it.
source code
line
safe_peekline(handle)
Peek at the next line in an UndoHandle and return it.
source code
Variables [hide private]
  xml_support = 1
  __package__ = 'Bio'
  __warningregistry__ = {('Bio.ParserSupport is now deprecated w...
Function Details [hide private]

read_and_call(uhandle, method, **keywds)

source code 

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 ValueError 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_while(uhandle, method, **keywds)

source code 

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.

read_and_call_until(uhandle, method, start=None, end=None, contains=None, blank=None)

source code 

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.

Returns: number of lines

attempt_read_and_call(uhandle, method, **keywds)

source code 

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.

Returns: boolean

is_blank_line(line, allow_spaces=0)

source code 
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.
Returns: boolean

safe_readline(handle)

source code 
Read a line from an UndoHandle and return it. If there are no more lines to read, I will raise a ValueError.
Returns: line

safe_peekline(handle)

source code 
Peek at the next line in an UndoHandle and return it. If there are no more lines to peek, I will raise a ValueError.
Returns: line

Variables Details [hide private]

__warningregistry__

Value:
{('Bio.ParserSupport is now deprecated will be removed in a future rel\
ease of Biopython.',
  <class 'Bio.BiopythonDeprecationWarning'>,
  31): True}