def _parse_main(path=MAIN_CF):
 with salt.utils.fopen(path, 'r') as fh_:
  full_conf = fh_.read()
 conf_list = []
 for line in full_conf.splitlines():
  if (not line.strip()):
   conf_list.append(line)
   continue
  if re.match(SWWS, line):
   if (not conf_list):
    conf_list.append(line)
    continue
   if (not isinstance(conf_list[(-1)], str)):
    conf_list[(-1)] = ''
   conf_list[(-1)] = '\n'.join([conf_list[(-1)], line])
  else:
   conf_list.append(line)
 pairs = {}
 for line in conf_list:
  if (not line.strip()):
   continue
  if line.startswith('#'):
   continue
  comps = line.split('=')
  pairs[comps[0].strip()] = '='.join(comps[1:]).strip()
 return (pairs, conf_list)

def _parse_main ( path = MAIN_CF ) : with salt . utils . fopen ( path , 'r' ) as fh_ : full_conf = fh_ . read ( ) conf_list = [ ] for line in full_conf . splitlines ( ) : if ( not line . strip ( ) ) : conf_list . append ( line ) continue if re . match ( SWWS , line ) : if ( not conf_list ) : conf_list . append ( line ) continue if ( not isinstance ( conf_list [ ( - 1 ) ] , str ) ) : conf_list [ ( - 1 ) ] = '' conf_list [ ( - 1 ) ] = '\n' . join ( [ conf_list [ ( - 1 ) ] , line ] ) else : conf_list . append ( line ) pairs = { } for line in conf_list : if ( not line . strip ( ) ) : continue if line . startswith ( '#' ) : continue comps = line . split ( '=' ) pairs [ comps [ 0 ] . strip ( ) ] = '=' . join ( comps [ 1 : ] ) . strip ( ) return ( pairs , conf_list )
parse files in the style of main .