77import pystac
88from pystac .extensions .base import ExtensionManagementMixin
99from pystac .extensions .hooks import ExtensionHooks
10- from pystac .item_assets import (
11- ItemAssetDefinition as AssetDefinition ,
12- )
10+ from pystac .item_assets import ItemAssetDefinition
1311from pystac .serialization .identify import STACJSONDescription , STACVersionID
1412from pystac .utils import get_required
1513
2119ITEM_ASSETS_PROP = "item_assets"
2220
2321
22+ class AssetDefinition (ItemAssetDefinition ):
23+ def __init__ (cls , * args : Any , ** kwargs : Any ) -> None :
24+ # TODO: deprecation warning in here.
25+ super ().__init__ (* args , ** kwargs )
26+
27+
2428class ItemAssetsExtension (ExtensionManagementMixin [pystac .Collection ]):
2529 name : Literal ["item_assets" ] = "item_assets"
2630 collection : pystac .Collection
@@ -29,16 +33,16 @@ def __init__(self, collection: pystac.Collection) -> None:
2933 self .collection = collection
3034
3135 @property
32- def item_assets (self ) -> dict [str , AssetDefinition ]:
36+ def item_assets (self ) -> dict [str , ItemAssetDefinition ]:
3337 """Gets or sets a dictionary of assets that can be found in member Items. Maps
3438 the asset key to an :class:`AssetDefinition` instance."""
3539 result : dict [str , Any ] = get_required (
3640 self .collection .extra_fields .get (ITEM_ASSETS_PROP ), self , ITEM_ASSETS_PROP
3741 )
38- return {k : AssetDefinition (v , self .collection ) for k , v in result .items ()}
42+ return {k : ItemAssetDefinition (v , self .collection ) for k , v in result .items ()}
3943
4044 @item_assets .setter
41- def item_assets (self , v : dict [str , AssetDefinition ]) -> None :
45+ def item_assets (self , v : dict [str , ItemAssetDefinition ]) -> None :
4246 self .collection .extra_fields [ITEM_ASSETS_PROP ] = {
4347 k : asset_def .properties for k , asset_def in v .items ()
4448 }
0 commit comments