Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sure that get_items does not recurse #608

Merged
merged 3 commits into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

### Fixed

- Recursion error in `get_items` [#608](https://github.com/stac-utils/pystac-client/pull/608)

## [v0.7.5] - 2023-09-05

### Fixed
Expand Down
10 changes: 7 additions & 3 deletions pystac_client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -438,12 +438,14 @@ def get_collections(self) -> Iterator[Collection]:
call_modifier(self.modifier, collection)
yield collection

def get_items(self, *ids: str, recursive: bool = False) -> Iterator["Item_Type"]:
def get_items(
self, *ids: str, recursive: Optional[bool] = None
) -> Iterator["Item_Type"]:
"""Return all items of this catalog.

Args:
ids: Zero or more item ids to find.
recursive: unused
recursive: unused in pystac-client, but needed for falling back to pystac

Return:
Iterator[Item]: Iterator of items whose parent is this
Expand All @@ -454,7 +456,9 @@ def get_items(self, *ids: str, recursive: bool = False) -> Iterator["Item_Type"]
yield from search.items()
else:
self._warn_about_fallback("ITEM_SEARCH")
for item in super().get_items(*ids, recursive=True):
for item in super().get_items(
*ids, recursive=recursive is None or recursive
):
call_modifier(self.modifier, item)
yield item

Expand Down
Loading
Loading