parameters: (self, args, config)
docstring: Runs the du command.
docstring_summary: Runs the du command.
docstring_tokens: Runs the du command .
function: def run(self, args, config):
      """Runs the du command."""
      config.ee_init()
  
      # Select all available asset roots if no asset ids are given.
      if not args.asset_id:
        assets = ee.data.getAssetRoots()
      else:
        assets = [ee.data.getInfo(asset) for asset in args.asset_id]
  
      # If args.summarize is True, list size+name for every leaf child asset,
      # and show totals for non-leaf children.
      # If args.summarize is False, print sizes of all children.
      for index, asset in enumerate(assets):
        if args.asset_id and not asset:
          asset_id = args.asset_id[index]
          print('Asset does not exist or is not accessible: %s' % asset_id)
          continue
        is_parent = asset['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,
        )
        if not is_parent or args.summarize:
          self._print_size(asset)
        else:
          children = ee.data.getList({'id': asset['id']})
          if not children:
            # A leaf asset
            children = [asset]
          for child in children:
            self._print_size(child)
function_tokens: def run ( self , args , config ) : config . ee_init ( ) # Select all available asset roots if no asset ids are given. if not args . asset_id : assets = ee . data . getAssetRoots ( ) else : assets = [ ee . data . getInfo ( asset ) for asset in args . asset_id ] # If args.summarize is True, list size+name for every leaf child asset, # and show totals for non-leaf children. # If args.summarize is False, print sizes of all children. for index , asset in enumerate ( assets ) : if args . asset_id and not asset : asset_id = args . asset_id [ index ] print ( 'Asset does not exist or is not accessible: %s' % asset_id ) continue is_parent = asset [ '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 , ) if not is_parent or args . summarize : self . _print_size ( asset ) else : children = ee . data . getList ( { 'id' : asset [ 'id' ] } ) if not children : # A leaf asset children = [ asset ] for child in children : self . _print_size ( child )