<s> import ConfigParser <EOL> import os <EOL> def read_config ( path = None ) : <EOL> """<STR_LIT>""" <EOL> confparser = ConfigParser . RawConfigParser ( ) <EOL> paths = [ '<STR_LIT>' , os . path . expanduser ( '<STR_LIT>' ) , <EOL> '<STR_LIT>' ] <EOL> if path : <EOL> paths . insert ( <NUM_LIT:0> , path ) <EOL> foundFile = None <EOL> for file in paths : <EOL> foundFile = confparser . read ( file ) <EOL> if foundFile : <EOL> break <EOL> if not foundFile : <EOL> import sys <EOL> sys . exit ( "<STR_LIT>" % paths ) <EOL> config = { } <EOL> for section in confparser . sections ( ) : <EOL> config [ section ] = { } <EOL> for ( key , val ) in confparser . items ( section ) : <EOL> config [ section ] [ key ] = val <EOL> return config </s>
