parameters: (self, data)
return_statement: return records
docstring: Extracts the records from a chunk of data.
docstring_summary: Extracts the records from a chunk of data.
docstring_tokens: Extracts the records from a chunk of data .
function: def _parse_chunk(self, data):
          '''
              Extracts the records from a chunk of data.
              '''
          records = []
          found = self.pat2.search(data)
          if found:
              end = found.start()
              if self.chunk_start > 0:  # optional?
                  self.chunk_start += end
          while found:
              start = found.start()
              if start-end > 1 and self.append_gaps:  # there's a gap between occurrences of the pattern
                  records[-1][-1] += data[end:start]  # append the gap to previous record
              records.append( self._extract_record(found) )
              end = found.end()
              found = self.pat2.search(data, end)
              if found and self.truncate_long_lines:  # shorten all but the last record
                  records[-1][-1] = self._shorten_query_field(records[-1][-1])
          if records:
              if self.append_gaps:
                  records[-1][-1] += data[end:]  # add what remains in data
              if self.truncate_long_lines:
                  records[-1][-1] = self._shorten_query_field(records[-1][-1])  # now shorten the last record
  
          self.record_count = len(records)
          return records
function_tokens: def _parse_chunk ( self , data ) : records = [ ] found = self . pat2 . search ( data ) if found : end = found . start ( ) if self . chunk_start > 0 : # optional? self . chunk_start += end while found : start = found . start ( ) if start - end > 1 and self . append_gaps : # there's a gap between occurrences of the pattern records [ - 1 ] [ - 1 ] += data [ end : start ] # append the gap to previous record records . append ( self . _extract_record ( found ) ) end = found . end ( ) found = self . pat2 . search ( data , end ) if found and self . truncate_long_lines : # shorten all but the last record records [ - 1 ] [ - 1 ] = self . _shorten_query_field ( records [ - 1 ] [ - 1 ] ) if records : if self . append_gaps : records [ - 1 ] [ - 1 ] += data [ end : ] # add what remains in data if self . truncate_long_lines : records [ - 1 ] [ - 1 ] = self . _shorten_query_field ( records [ - 1 ] [ - 1 ] ) # now shorten the last record self . record_count = len ( records ) return records