<s> """<STR_LIT>""" <EOL> from utils import join_paths <EOL> import ast <EOL> import ConfigParser <EOL> class ConfParser ( ) : <EOL> from localsettings import SRC_DIR <EOL> plugins_path = join_paths ( [ SRC_DIR , "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> @ staticmethod <EOL> def parse_config ( plugin_name , path = "<STR_LIT>" ) : <EOL> """<STR_LIT>""" <EOL> ConfParser . plugin_name = plugin_name <EOL> settings = { } <EOL> try : <EOL> confparser = ConfigParser . RawConfigParser ( ) <EOL> confparser . readfp ( open ( path ) ) <EOL> for section in confparser . sections ( ) : <EOL> settings [ section ] = { } <EOL> for ( key , val ) in confparser . items ( section ) : <EOL> settings [ section ] [ key ] = ast . literal_eval ( val ) <EOL> if section == "<STR_LIT>" : <EOL> settings [ section ] [ "<STR_LIT>" % key ] = settings [ section ] [ key ] <EOL> settings [ section ] [ key ] = ConfParser . parse_path ( plugin_name , settings [ section ] [ key ] ) <EOL> except Exception as e : <EOL> print "<STR_LIT>" % ( str ( path ) , str ( e ) ) <EOL> return settings <EOL> @ staticmethod <EOL> def parse_path ( plugin_name , plugin_path ) : <EOL> """<STR_LIT>""" <EOL> try : <EOL> plugin_path = join_paths ( [ [ ConfParser . plugins_path ] , plugin_name , plugin_path ] ) <EOL> except Exception as e : <EOL> print "<STR_LIT>" % str ( e ) <EOL> return plugin_path </s>
