def _GetAttributeScripts(self, attribute_data, dest_dir):
    """Retrieve the scripts from attribute metadata.

    Args:
      attribute_data: dict, the contents of the attributes metadata.
      dest_dir: string, the path to a directory for storing metadata scripts.

    Returns:
      dict, a dictionary mapping metadata keys to files storing scripts.
    """
    script_dict = {}
    attribute_data = attribute_data or {}
    metadata_key = '%s-script' % self.script_type
    metadata_value = attribute_data.get(metadata_key)
    if metadata_value:
      self.logger.info('Found %s in metadata.', metadata_key)
      with tempfile.NamedTemporaryFile(
          mode='w', dir=dest_dir, delete=False) as dest:
        dest.write(metadata_value.lstrip())
        script_dict[metadata_key] = dest.name

    metadata_key = '%s-script-url' % self.script_type
    metadata_value = attribute_data.get(metadata_key)
    if metadata_value:
      self.logger.info('Found %s in metadata.', metadata_key)
      script_dict[metadata_key] = self._DownloadScript(
          metadata_value, dest_dir)

    return script_dict
def _GetAttributeScripts ( self , attribute_data , dest_dir ) : script_dict = { } attribute_data = attribute_data or { } metadata_key = '%s-script' % self . script_type metadata_value = attribute_data . get ( metadata_key ) if metadata_value : self . logger . info ( 'Found %s in metadata.' , metadata_key ) with tempfile . NamedTemporaryFile ( mode = 'w' , dir = dest_dir , delete = False ) as dest : dest . write ( metadata_value . lstrip ( ) ) script_dict [ metadata_key ] = dest . name metadata_key = '%s-script-url' % self . script_type metadata_value = attribute_data . get ( metadata_key ) if metadata_value : self . logger . info ( 'Found %s in metadata.' , metadata_key ) script_dict [ metadata_key ] = self . _DownloadScript ( metadata_value , dest_dir ) return script_dict
Retrieve the scripts from attribute metadata.

    Args:
      attribute_data: dict, the contents of the attributes metadata.
      dest_dir: string, the path to a directory for storing metadata scripts.

    Returns:
      dict, a dictionary mapping metadata keys to files storing scripts.