<s> import codecs <EOL> class SettingsLoadStrategyCfg ( object ) : <EOL> """<STR_LIT>""" <EOL> name = '<STR_LIT>' <EOL> @ classmethod <EOL> def is_valid_file ( cls , file_name ) : <EOL> return file_name . endswith ( '<STR_LIT>' ) <EOL> @ classmethod <EOL> def load_settings_file ( cls , settings_file ) : <EOL> result = { } <EOL> with codecs . open ( settings_file , '<STR_LIT:r>' , '<STR_LIT:utf-8>' ) as f : <EOL> settings = [ <EOL> line . split ( '<STR_LIT:=>' ) for line in f if cls . _is_valid_line ( line ) <EOL> ] <EOL> for k , v in settings : <EOL> result [ k . strip ( ) ] = v . strip ( ) <EOL> return result <EOL> @ classmethod <EOL> def _is_valid_line ( cls , line ) : <EOL> clean_line = line . strip ( ) <EOL> return bool ( <EOL> clean_line <EOL> and not clean_line . startswith ( '<STR_LIT:#>' ) <EOL> and len ( clean_line . split ( '<STR_LIT:=>' ) ) == <NUM_LIT:2> <EOL> ) </s>
