def _docstring_getblocks(self):
        """Gets the longest continuous block of docstrings from the buffer
        code string if any of those lines are docstring lines.
        """
        #If there are no lines to look at, we have nothing to do here.
        if self.ibuffer[0] == self.ibuffer[1]:
            return []

        lines = self.context.bufferstr[self.ibuffer[0]:self.ibuffer[1]]
        docblock = []
        result = []
        self._doclines = []

        #We need to keep track of the line number for the start of the
        #documentation strings.
        docline = 0
        doclength = 0

        first = self.docparser.RE_DOCS.match(lines[0])
        if first is not None:
            docblock.append(first.group("docstring"))
            docline = self.ibuffer[0]
            self._doclines.append(docline)
            doclength += len(lines[0]) + 1 # + 1 for \n removed by split.

            #We need to search backwards in the main buffer string for
            #additional tags to add to the block
            i = self.ibuffer[0] - 1
            while i > 0:
                current = self.context.bufferstr[i]
                docmatch = self.docparser.RE_DOCS.match(current)
                if docmatch is not None:
                    docblock.append(docmatch.group("docstring"))
                    docline = i
                    doclength += len(current) + 1
                else:
                    break
                i -= 1

        #Reverse the docblock list since we were going backwards and appending.
        if len(docblock) > 0:
            docblock.reverse()

        #Now handle the lines following the first line. Also handle the
        #possibility of multiple, separate blocks that are still valid XML.
        #We have to keep going until we have exceed the operational changes
        #or found the decorating element.
        i = self.ibuffer[0] + 1
        while (i < len(self.context.bufferstr) and 
               (i < self.ibuffer[1] or len(docblock) > 0)):
            line = self.context.bufferstr[i]
            docmatch = self.docparser.RE_DOCS.match(line)
            if docmatch is not None:
                docblock.append(docmatch.group("docstring"))
                doclength += len(line)
                if docline == 0:
                    docline = i
                #Only track actual documentation lines that are within the 
                #operations list of lines.
                if i < self.ibuffer[1]:
                    self._doclines.append(i)

            elif len(docblock) > 0:
                key = self._docstring_key(line)
                result.append((docblock, docline, doclength, key))
                docblock = []
                docline = 0
                doclength = 0

            #We need to exit the loop if we have exceeded the length of
            #the operational changes
            if len(docblock) == 0 and i > self.ibuffer[1]:
                break
            i += 1

        return result
def _docstring_getblocks ( self ) : if self . ibuffer [ 0 ] == self . ibuffer [ 1 ] : return [ ] lines = self . context . bufferstr [ self . ibuffer [ 0 ] : self . ibuffer [ 1 ] ] docblock = [ ] result = [ ] self . _doclines = [ ] docline = 0 doclength = 0 first = self . docparser . RE_DOCS . match ( lines [ 0 ] ) if first is not None : docblock . append ( first . group ( "docstring" ) ) docline = self . ibuffer [ 0 ] self . _doclines . append ( docline ) doclength += len ( lines [ 0 ] ) + 1 i = self . ibuffer [ 0 ] - 1 while i > 0 : current = self . context . bufferstr [ i ] docmatch = self . docparser . RE_DOCS . match ( current ) if docmatch is not None : docblock . append ( docmatch . group ( "docstring" ) ) docline = i doclength += len ( current ) + 1 else : break i -= 1 if len ( docblock ) > 0 : docblock . reverse ( ) i = self . ibuffer [ 0 ] + 1 while ( i < len ( self . context . bufferstr ) and ( i < self . ibuffer [ 1 ] or len ( docblock ) > 0 ) ) : line = self . context . bufferstr [ i ] docmatch = self . docparser . RE_DOCS . match ( line ) if docmatch is not None : docblock . append ( docmatch . group ( "docstring" ) ) doclength += len ( line ) if docline == 0 : docline = i if i < self . ibuffer [ 1 ] : self . _doclines . append ( i ) elif len ( docblock ) > 0 : key = self . _docstring_key ( line ) result . append ( ( docblock , docline , doclength , key ) ) docblock = [ ] docline = 0 doclength = 0 if len ( docblock ) == 0 and i > self . ibuffer [ 1 ] : break i += 1 return result
Gets the longest continuous block of docstrings from the buffer
        code string if any of those lines are docstring lines.