<s> """<STR_LIT>""" <EOL> from __future__ import absolute_import <EOL> from __future__ import division <EOL> from __future__ import print_function <EOL> from __future__ import unicode_literals <EOL> import yaml <EOL> from parselmouth . exceptions import ParselmouthException <EOL> from parselmouth . adapters . abstract_config import AbstractConfig <EOL> class DFPConfig ( AbstractConfig ) : <EOL> """<STR_LIT>""" <EOL> _credentials = { <EOL> '<STR_LIT>' : None , <EOL> '<STR_LIT>' : None , <EOL> '<STR_LIT>' : None , <EOL> '<STR_LIT>' : None , <EOL> '<STR_LIT>' : None , <EOL> } <EOL> """<STR_LIT>""" <EOL> def validate_credentials ( self ) : <EOL> """<STR_LIT>""" <EOL> for _key , _val in self . _credentials . items ( ) : <EOL> if _val is None : <EOL> raise ParselmouthException ( "<STR_LIT>" . format ( _key ) ) <EOL> def get_credentials_arguments ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . _credentials <EOL> def load_config_from_file ( self , provider_name , config_path ) : <EOL> with open ( config_path , '<STR_LIT:r>' ) as infile : <EOL> config_dict = yaml . load ( infile ) <EOL> self . _credentials = { <EOL> '<STR_LIT>' : config_dict [ provider_name ] [ '<STR_LIT>' ] , <EOL> '<STR_LIT>' : config_dict [ provider_name ] [ '<STR_LIT>' ] , <EOL> '<STR_LIT>' : config_dict [ provider_name ] [ '<STR_LIT>' ] , <EOL> '<STR_LIT>' : config_dict [ provider_name ] [ '<STR_LIT>' ] , <EOL> '<STR_LIT>' : config_dict [ provider_name ] [ '<STR_LIT>' ] , <EOL> } <EOL> def load_config_from_external_source ( self , <EOL> client_id , <EOL> client_secret , <EOL> refresh_token , <EOL> application_name , <EOL> network_code ) : <EOL> """<STR_LIT>""" <EOL> self . _credentials = { <EOL> '<STR_LIT>' : client_id , <EOL> '<STR_LIT>' : client_secret , <EOL> '<STR_LIT>' : refresh_token , <EOL> '<STR_LIT>' : application_name , <EOL> '<STR_LIT>' : network_code , <EOL> } </s>
