def _parse_pre_yarn_history_records(lines):
 def yield_record_strings(lines):
  record_lines = []
  start_line = 0
  for (line_num, line) in enumerate(lines):
   record_lines.append(line)
   if line.endswith(' .\n'):
    (yield (start_line, len(record_lines), ''.join(record_lines)))
    record_lines = []
    start_line = (line_num + 1)
 for (start_line, num_lines, record_str) in yield_record_strings(lines):
  record_match = _PRE_YARN_HISTORY_RECORD.match(record_str)
  if (not record_match):
   continue
  record_type = record_match.group('type')
  key_pairs = record_match.group('key_pairs')
  fields = {}
  for m in _PRE_YARN_HISTORY_KEY_PAIR.finditer(key_pairs):
   key = m.group('key')
   value = _pre_yarn_history_unescape(m.group('escaped_value'))
   fields[key] = value
  (yield dict(fields=fields, num_lines=num_lines, start_line=start_line, type=record_type))

def _parse_pre_yarn_history_records ( lines ) : def yield_record_strings ( lines ) : record_lines = [ ] start_line = 0 for ( line_num , line ) in enumerate ( lines ) : record_lines . append ( line ) if line . endswith ( ' .\n' ) : ( yield ( start_line , len ( record_lines ) , '' . join ( record_lines ) ) ) record_lines = [ ] start_line = ( line_num + 1 ) for ( start_line , num_lines , record_str ) in yield_record_strings ( lines ) : record_match = _PRE_YARN_HISTORY_RECORD . match ( record_str ) if ( not record_match ) : continue record_type = record_match . group ( 'type' ) key_pairs = record_match . group ( 'key_pairs' ) fields = { } for m in _PRE_YARN_HISTORY_KEY_PAIR . finditer ( key_pairs ) : key = m . group ( 'key' ) value = _pre_yarn_history_unescape ( m . group ( 'escaped_value' ) ) fields [ key ] = value ( yield dict ( fields = fields , num_lines = num_lines , start_line = start_line , type = record_type ) )
yield records from the given sequence of lines .