Skip to content

Commit 3c7b16d

Browse files
fix get items recursive documentation (stac-utils#800)
* fix get items recursive documentation * update changelog * add warning * formatting update
1 parent 5fae268 commit 3c7b16d

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1111

1212
- Fix usage documentation of `ItemSearch`
1313
- Fix fields argument to CLI ([#797](https://github.com/stac-utils/pystac-client/pull/797))
14+
- Clarify recursive behaviour of the `get_items` method in the method docstring ([#800](https://github.com/stac-utils/pystac-client/pull/800))
1415

1516
## [v0.8.6] - 2025-02-11
1617

pystac_client/client.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,12 @@
3636
)
3737
from pystac_client.mixins import QUERYABLES_ENDPOINT, QueryablesMixin
3838
from pystac_client.stac_api_io import StacApiIO, Timeout
39-
from pystac_client.warnings import DoesNotConformTo, FallbackToPystac, NoConformsTo
39+
from pystac_client.warnings import (
40+
DoesNotConformTo,
41+
FallbackToPystac,
42+
NoConformsTo,
43+
PystacClientWarning,
44+
)
4045

4146
if TYPE_CHECKING:
4247
from pystac.item import Item as Item_Type
@@ -450,13 +455,20 @@ def get_items(
450455
451456
Args:
452457
ids: Zero or more item ids to find.
453-
recursive: unused in pystac-client, but needed for falling back to pystac
454-
458+
recursive: If this client conforms to the ITEM_SEARCH conformance class,
459+
this is unused and this will always yield items recursively.
460+
Otherwise, this will only return items recursively if True or None.
455461
Return:
456462
Iterator[Item]: Iterator of items whose parent is this
457463
catalog.
458464
"""
459465
if self.conforms_to(ConformanceClasses.ITEM_SEARCH):
466+
if recursive is False:
467+
warnings.warn(
468+
"Getting items recursively using the /search endpoint "
469+
"(the recursive argument is being ignored).",
470+
PystacClientWarning,
471+
)
460472
search = self.search(ids=ids)
461473
yield from search.items()
462474
else:

0 commit comments

Comments
 (0)