def _parse_indented_counters(lines):
 counters = {}
 group = None
 group_indent = None
 for line in lines:
  if (not ((group is None) or (group_indent is None))):
   m = _INDENTED_COUNTER_RE.match(line)
   if (m and (len(m.group('indent')) > group_indent)):
    counter = m.group('counter')
    amount = int(m.group('amount'))
    counters.setdefault(group, {})
    counters[group][counter] = amount
    continue
  m = _INDENTED_COUNTER_GROUP_RE.match(line)
  if m:
   group = m.group('group')
   group_indent = len(m.group('indent'))
  elif (not _INDENTED_COUNTERS_MESSAGE_RE.match(line)):
   log.warning(('unexpected counter line: %s' % line))
 return counters

def _parse_indented_counters ( lines ) : counters = { } group = None group_indent = None for line in lines : if ( not ( ( group is None ) or ( group_indent is None ) ) ) : m = _INDENTED_COUNTER_RE . match ( line ) if ( m and ( len ( m . group ( 'indent' ) ) > group_indent ) ) : counter = m . group ( 'counter' ) amount = int ( m . group ( 'amount' ) ) counters . setdefault ( group , { } ) counters [ group ] [ counter ] = amount continue m = _INDENTED_COUNTER_GROUP_RE . match ( line ) if m : group = m . group ( 'group' ) group_indent = len ( m . group ( 'indent' ) ) elif ( not _INDENTED_COUNTERS_MESSAGE_RE . match ( line ) ) : log . warning ( ( 'unexpected counter line: %s' % line ) ) return counters
parse counters in the indented format output/logged by the hadoop binary .