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

PERF: Avoid copy in pystac for ItemCollections #90

Merged
merged 3 commits into from
Sep 19, 2021
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

### Changed

- Improved performance when constructing `pystac.ItemCollection` objects.
- Relax `requests` dependency [#87](https://github.com/stac-utils/pystac-client/pull/87)

## [v0.2.0] - 2021-08-04
Expand Down
4 changes: 2 additions & 2 deletions pystac_client/item_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ def get_item_collections(self) -> Iterator[ItemCollection]:
item_collection : pystac_client.ItemCollection
"""
for page in self._stac_io.get_pages(self.url, self.method, self.get_parameters()):
yield ItemCollection.from_dict(page, root=self.client)
yield ItemCollection.from_dict(page, preserve_dict=False, root=self.client)

def get_items(self) -> Iterator[Item]:
"""Iterator that yields :class:`pystac.Item` instances for each item matching the given search parameters. Calls
Expand Down Expand Up @@ -443,4 +443,4 @@ def get_all_items(self) -> ItemCollection:
item_collection : ItemCollection
"""
feature_collection = self.get_all_items_as_dict()
return ItemCollection(feature_collection['features'])
return ItemCollection.from_dict(feature_collection, preserve_dict=False, root=self.client)