Logo Search packages:      
Sourcecode: python-biopython version File versions

def Bio::ParserSupport::EventGenerator::__init__ (   self,
  consumer,
  interest_tags,
  callback_finalizer = None,
  exempt_tags = [] 
)

Initialize to begin catching and firing off events.

Arguments:
o consumer - The consumer that we'll send Biopython events to.

o interest_tags - A listing of all the tags we are interested in.

o callback_finalizer - A function to deal with the collected
information before passing it on to the consumer. By default
the collected information is a list of all of the lines read
for a particular tag -- if there are multiple tags in a row
like:

<some_info>Spam<some_info>
<some_info>More Spam<some_info>

In this case the list of information would be:

['Spam', 'More Spam']

This list of lines will be passed to the callback finalizer if
it is present. Otherwise the consumer will be called with the
list of content information.

o exempt_tags - A listing of particular tags that are exempt from
being processed by the callback_finalizer. This allows you to
use a finalizer to deal with most tags, but leave those you don't
want touched.

Definition at line 162 of file ParserSupport.py.

                                      :
            """Initialize to begin catching and firing off events.

            Arguments:
            o consumer - The consumer that we'll send Biopython events to.
            
            o interest_tags - A listing of all the tags we are interested in.

            o callback_finalizer - A function to deal with the collected
            information before passing it on to the consumer. By default
            the collected information is a list of all of the lines read
            for a particular tag -- if there are multiple tags in a row
            like:

            <some_info>Spam<some_info>
            <some_info>More Spam<some_info>

            In this case the list of information would be:

            ['Spam', 'More Spam']
            
            This list of lines will be passed to the callback finalizer if
            it is present. Otherwise the consumer will be called with the
            list of content information.

            o exempt_tags - A listing of particular tags that are exempt from
            being processed by the callback_finalizer. This allows you to
            use a finalizer to deal with most tags, but leave those you don't
            want touched.
            """
            self._consumer = consumer
            self.interest_tags = interest_tags
            self._finalizer = callback_finalizer
            self._exempt_tags = exempt_tags

            # a dictionary of content for each tag of interest
            # the information for each tag is held as a list of the lines.
            # This allows us to collect information from multiple tags
            # in a row, and return it all at once.
            self.info = {}
            for tag in self.interest_tags:
                self.info[tag] = []

            # the previous tag we were collecting information for.
            # We set a delay in sending info to the consumer so that we can
            # collect a bunch of tags in a row and append all of the info
            # together.
            self._previous_tag = ''

            # the current character information for a tag
            self._cur_content = []
            # whether we should be collecting information
            self._collect_characters = 0

        def startElement(self, name, attrs):


Generated by  Doxygen 1.6.0   Back to index