Asset Base class

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

Bases: abc.ABC, Generic[starfish.types.AssetBase]

Parameters
  • metadata_text (str) – metadata text for the asset

  • did (None or str) – Octional did of the asset, if the asset is new then the did will be None.

property asset_id: str
static calc_asset_id(metadata_text)
property data: bytes
property did: str
Returns

the asset did

Type

str

static generateMetadata(name: str, asset_type: str, metadata: Optional[Any] = None) Any
static get_asset_type(metadata: Any) str
is_asset_type(type_name: str) bool

Returns if this metadata has the correct type

Parameters

type_name (str) – name of the asset type stored in the metadata

Returns

True if the metadata type is equal to type_name

Type

boolean

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

property is_new: bool

Return True if this asset has not been saved, and can be changed.

Returns

True if no did has been set

property metadata: Any

WARNING: The read only version for this metadata, use set_metadata to assign a new metadata. Once you change metadata, the asset id is changed and the did is set to None.

Returns

The metadata for this asset

Type

dict

property metadata_text: str
Returns

The metadata for this asset

Type

dict

property name: str
property type_name: str