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
Debugging consumer which tags data with the event and logs it.
Functions [hide private]
 
read_and_call(uhandle, method, **keywds)
Read line and pass it to the method.
source code
 
read_and_call_while(uhandle, method, **keywds)
Read line and pass it to the method while condition is true.
source code
 
read_and_call_until(uhandle, method, **keywds)
Read line and pass it to the method until condition is true.
source code
 
attempt_read_and_call(uhandle, method, **keywds)
Attempt read line and call method.
source code
 
_fails_conditions(line, start=None, end=None, contains=None, blank=None, has_re=None) source code
 
is_blank_line(line, allow_spaces=0)
Check if a line is blank.
source code
 
safe_readline(handle)
Read a line, otherwise raises ValueError.
source code
 
safe_peekline(handle)
Peek at the next line if present, otherwise raises ValueError.
source code
Variables [hide private]
  __package__ = 'Bio'
  __warningregistry__ = {('Bio.ParserSupport is now deprecated w...
Function Details [hide private]

read_and_call(uhandle, method, **keywds)

source code 

Read line and pass it to the method.

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 line and pass it to the method while condition is true.

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, **keywds)

source code 

Read line and pass it to the method until condition is true.

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.

attempt_read_and_call(uhandle, method, **keywds)

source code 

Attempt read line and call method.

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)

source code 

Check if a line is blank.

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.

safe_readline(handle)

source code 

Read a line, otherwise raises ValueError.

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

safe_peekline(handle)

source code 

Peek at the next line if present, otherwise raises ValueError.

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


Variables Details [hide private]

__warningregistry__

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