Skip to content

Commit ace4ba2

Browse files
author
Jon Duckworth
authored
Merge pull request #386 from schwehr/datacube-typing
datacube.py: Additional class member typing
2 parents 3f2f95f + 24b86af commit ace4ba2

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

pystac/extensions/datacube.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232

3333

3434
class Dimension(ABC):
35+
properties: Dict[str, Any]
36+
3537
def __init__(self, properties: Dict[str, Any]) -> None:
3638
self.properties = properties
3739

@@ -350,6 +352,9 @@ def ext(obj: T) -> "DatacubeExtension[T]":
350352

351353

352354
class CollectionDatacubeExtension(DatacubeExtension[pystac.Collection]):
355+
collection: pystac.Collection
356+
properties: Dict[str, Any]
357+
353358
def __init__(self, collection: pystac.Collection):
354359
self.collection = collection
355360
self.properties = collection.extra_fields
@@ -359,6 +364,9 @@ def __repr__(self) -> str:
359364

360365

361366
class ItemDatacubeExtension(DatacubeExtension[pystac.Item]):
367+
item: pystac.Item
368+
properties: Dict[str, Any]
369+
362370
def __init__(self, item: pystac.Item):
363371
self.item = item
364372
self.properties = item.properties
@@ -368,11 +376,17 @@ def __repr__(self) -> str:
368376

369377

370378
class AssetDatacubeExtension(DatacubeExtension[pystac.Asset]):
379+
asset_href: str
380+
properties: Dict[str, Any]
381+
additional_read_properties: Optional[List[Dict[str, Any]]]
382+
371383
def __init__(self, asset: pystac.Asset):
372384
self.asset_href = asset.href
373385
self.properties = asset.properties
374386
if asset.owner and isinstance(asset.owner, pystac.Item):
375387
self.additional_read_properties = [asset.owner.properties]
388+
else:
389+
self.additional_read_properties = None
376390

377391
def __repr__(self) -> str:
378392
return "<AssetDatacubeExtension Item id={}>".format(self.asset_href)

0 commit comments

Comments
 (0)