<s> import config_json <EOL> import config_jsonnet <EOL> import config_py <EOL> class InvalidArgumentError ( Exception ) : <EOL> pass <EOL> class InvalidConfigFilename ( Exception ) : <EOL> pass <EOL> def ProcessConfig ( ** kwargs ) : <EOL> if '<STR_LIT:file>' not in kwargs : <EOL> raise InvalidArgumentError ( '<STR_LIT>' ) <EOL> ext_to_config = { <EOL> '<STR_LIT>' : config_json . ConfigExpander , <EOL> '<STR_LIT>' : config_jsonnet . ConfigExpander , <EOL> '<STR_LIT>' : config_py . ConfigExpander , <EOL> } <EOL> filename = kwargs [ '<STR_LIT:file>' ] <EOL> for ext , config in ext_to_config . iteritems ( ) : <EOL> if filename . endswith ( ext ) : <EOL> return config ( ** kwargs ) . ExpandFile ( filename ) <EOL> raise InvalidConfigFilename ( <EOL> '<STR_LIT>' % filename ) </s>
