Skip to content

Add args/kwargs to StacIO.read_json #433

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

Merged
merged 2 commits into from
Jun 11, 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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
### Changed

- Package author to `stac-utils`, email to `stac@radiant.earth`, url to this repo ([#409](https://github.com/stac-utils/pystac/pull/409))
- `StacIO.read_json` passes arbitrary positional and keyword arguments to
`StacIO.read_text` ([#433](https://github.com/stac-utils/pystac/pull/433))

### Fixed

Expand Down
6 changes: 4 additions & 2 deletions pystac/stac_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,9 @@ def stac_object_from_dict(
result._stac_io = self
return result

def read_json(self, source: Union[str, "Link_Type"]) -> Dict[str, Any]:
def read_json(
self, source: Union[str, "Link_Type"], *args: Any, **kwargs: Any
) -> Dict[str, Any]:
"""Read a dict from the given source.

See :func:`StacIO.read_text <pystac.StacIO.read_text>` for usage of
Expand All @@ -115,7 +117,7 @@ def read_json(self, source: Union[str, "Link_Type"]) -> Dict[str, Any]:
dict: A dict representation of the JSON contained in the file at the
given source.
"""
txt = self.read_text(source)
txt = self.read_text(source, *args, **kwargs)
return self._json_loads(txt, source)

def read_stac_object(
Expand Down