<s> import logging <EOL> import sys <EOL> if sys . version_info [ <NUM_LIT:0> ] >= <NUM_LIT:3> : <EOL> from configparser import ConfigParser <EOL> else : <EOL> from ConfigParser import ConfigParser <EOL> logger = logging . getLogger ( __name__ ) <EOL> class EdgeRc ( ConfigParser ) : <EOL> required_options = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT:host>' , '<STR_LIT>' ] <EOL> def __init__ ( self , filename ) : <EOL> ConfigParser . __init__ ( self , { '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT>' : None } ) <EOL> logger . debug ( "<STR_LIT>" , filename ) <EOL> self . read ( filename ) <EOL> self . validate ( ) <EOL> logger . debug ( "<STR_LIT>" ) <EOL> def optionxform ( self , optionstr ) : <EOL> """<STR_LIT>""" <EOL> return optionstr . replace ( '<STR_LIT:->' , '<STR_LIT:_>' ) <EOL> def validate ( self ) : <EOL> def validate_section ( section ) : <EOL> missing = [ ] <EOL> for opt in self . required_options : <EOL> try : <EOL> self . get ( section , opt ) <EOL> except : <EOL> missing . append ( opt ) <EOL> if len ( missing ) > <NUM_LIT:0> : <EOL> raise Exception ( "<STR_LIT>" % missing ) <EOL> for section in self . sections ( ) : <EOL> validate_section ( section ) <EOL> def getlist ( self , section , option ) : <EOL> """<STR_LIT>""" <EOL> value = self . get ( section , option ) <EOL> if value : <EOL> return value . split ( '<STR_LIT:U+002C>' ) <EOL> else : <EOL> return None </s>
