def load_credential(self, cloud, name=None):
        """Load a local credential.

        :param str cloud: Name of cloud to load credentials from.
        :param str name: Name of credential. If None, the default credential
            will be used, if available.
        :return: A CloudCredential instance, or None.
        """
        try:
            cloud = tag.untag('cloud-', cloud)
            creds_data = self.credentials()[cloud]
            if not name:
                default_credential = creds_data.pop('default-credential', None)
                default_region = creds_data.pop('default-region', None)  # noqa
                if default_credential:
                    name = creds_data['default-credential']
                elif len(creds_data) == 1:
                    name = list(creds_data)[0]
                else:
                    return None, None
            cred_data = creds_data[name]
            auth_type = cred_data.pop('auth-type')
            return name, jujuclient.CloudCredential(
                auth_type=auth_type,
                attrs=cred_data,
            )
        except (KeyError, FileNotFoundError):
            return None, None
def load_credential ( self , cloud , name = None ) : try : cloud = tag . untag ( 'cloud-' , cloud ) creds_data = self . credentials ( ) [ cloud ] if not name : default_credential = creds_data . pop ( 'default-credential' , None ) default_region = creds_data . pop ( 'default-region' , None ) if default_credential : name = creds_data [ 'default-credential' ] elif len ( creds_data ) == 1 : name = list ( creds_data ) [ 0 ] else : return None , None cred_data = creds_data [ name ] auth_type = cred_data . pop ( 'auth-type' ) return name , jujuclient . CloudCredential ( auth_type = auth_type , attrs = cred_data , ) except ( KeyError , FileNotFoundError ) : return None , None
Load a local credential.

        :param str cloud: Name of cloud to load credentials from.
        :param str name: Name of credential. If None, the default credential
            will be used, if available.
        :return: A CloudCredential instance, or None.