diff --git a/stackstac/stac_types.py b/stackstac/stac_types.py index 72a5a1a..f95540c 100644 --- a/stackstac/stac_types.py +++ b/stackstac/stac_types.py @@ -45,13 +45,18 @@ class PystacCatalog: def get_all_items(self) -> Iterator[PystacItem]: ... + # pystac 1.0 try: from pystac import ItemCollection as PystacItemCollection except ImportError: + class PystacItemCollection: features: List[PystacItem] + def __iter__(self) -> Iterator[PystacItem]: + ... + class EOBand(TypedDict, total=False): name: str @@ -151,8 +156,8 @@ def items_to_plain(items: Union[ItemCollectionIsh, ItemIsh]) -> ItemSequence: # which can handle each object type, preventing the need for this sort of copying. if isinstance(items, PystacCatalog): return [item.to_dict() for item in items.get_all_items()] - + if isinstance(items, PystacItemCollection): return [item.to_dict() for item in items] - + raise TypeError(f"Unrecognized STAC collection type {type(items)}: {items!r}")