(self, asset_id, recursive, verbose, dry_run)
Attempts to delete the specified asset or asset collection.
Attempts to delete the specified asset or asset collection.
Attempts to delete the specified asset or asset collection .
def _delete_asset(self, asset_id, recursive, verbose, dry_run):
    """Attempts to delete the specified asset or asset collection."""
    if recursive:
      info = ee.data.getInfo(asset_id)
      if info is None:
        print('Asset does not exist or is not accessible: %s' % asset_id)
        return
      if info['type'] in (ee.data.ASSET_TYPE_FOLDER,
                          ee.data.ASSET_TYPE_IMAGE_COLL,
                          ee.data.ASSET_TYPE_FOLDER_CLOUD,
                          ee.data.ASSET_TYPE_IMAGE_COLL_CLOUD):
        children = ee.data.getList({'id': asset_id})
        for child in children:
          self._delete_asset(child['id'], True, verbose, dry_run)
    if dry_run:
      print('[dry-run] Deleting asset: %s' % asset_id)
    else:
      if verbose:
        print('Deleting asset: %s' % asset_id)
      try:
        ee.data.deleteAsset(asset_id)
      except ee.EEException as e:
        print('Failed to delete %s. %s' % (asset_id, e))
def _delete_asset ( self , asset_id , recursive , verbose , dry_run ) : if recursive : info = ee . data . getInfo ( asset_id ) if info is None : print ( 'Asset does not exist or is not accessible: %s' % asset_id ) return if info [ 'type' ] in ( ee . data . ASSET_TYPE_FOLDER , ee . data . ASSET_TYPE_IMAGE_COLL , ee . data . ASSET_TYPE_FOLDER_CLOUD , ee . data . ASSET_TYPE_IMAGE_COLL_CLOUD ) : children = ee . data . getList ( { 'id' : asset_id } ) for child in children : self . _delete_asset ( child [ 'id' ] , True , verbose , dry_run ) if dry_run : print ( '[dry-run] Deleting asset: %s' % asset_id ) else : if verbose : print ( 'Deleting asset: %s' % asset_id ) try : ee . data . deleteAsset ( asset_id ) except ee . EEException as e : print ( 'Failed to delete %s. %s' % ( asset_id , e ) )