Bundle Asset class

class starfish.asset.BundleAsset(metadata_text: str, did: Optional[str] = None)

Bases: starfish.asset.asset_base.AssetBase, Generic[starfish.types.BundleAsset]

Bundle asset can be used to hold many assets

Parameters
  • metadata (dict) – Dictionary metadata to provide for the asset

  • did (None or str) – Optional did of the asset if it’s registered

add(name: str, asset: starfish.asset.asset_base.AssetBase) None

Add an asset to the bundle. Any asset object

Parameters
  • name (string) – name of the asset in the bundle

  • asset (Asset object) – asset to add to the bundle collection

Returns

new bundle asset with the added asset

property asset_count: int

Return the number of assets in this bundle

Returns

count of assets

Type

int

property asset_items: Dict[str, str]
property asset_names: List[str]
asset_remove(name: str) str

Remove an asset from the bundle with a given name

Parameters

name (str) – name of the asset to remove

Returns

the removed asset id

Type

str

Returns

new bundle asset without the asset

static create(name: str, asset_list: Optional[any] = None, metadata: Optional[Any] = None) starfish.types.BundleAsset

Create a new empty BundleAsset

Parameters
  • name (str) – Name of the asset to create

  • asset_list (dict) – List of assets and their names

  • metadata (dict) – Optional metadata to add to the assets metadata

  • did (str) – Option DID to assign to this asset

Returns

a new BundleAsset

Type

BundleAsset

get_asset_id(name: str) str

Return the asset in the bundle based on it’s index number

Parameters

name (str) – name of the asset in this bundle

Returns

asset id is returned

Type

str

Raises

ValueError if name is not found in the bundle

get_asset_id_at_index(index) str

return the asset based on the index of available assets

property is_bundle: bool

Return True if this asset is a bundle asset and can contain sub assets ( Asset Bundle )

Returns

True if sub assets can be held within this asset

Type

boolean