Skip to content

Commit a688988

Browse files
committed
Export AssetDefinition
1 parent c80e307 commit a688988

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

pystac/extensions/item_assets.py

+10-6
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@
77
import pystac
88
from pystac.extensions.base import ExtensionManagementMixin
99
from pystac.extensions.hooks import ExtensionHooks
10-
from pystac.item_assets import (
11-
ItemAssetDefinition as AssetDefinition,
12-
)
10+
from pystac.item_assets import ItemAssetDefinition
1311
from pystac.serialization.identify import STACJSONDescription, STACVersionID
1412
from pystac.utils import get_required
1513

@@ -21,6 +19,12 @@
2119
ITEM_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+
2428
class 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

Comments
 (0)