Skip to content

Commit

Permalink
better credits type hint for actual behavior from HyP3
Browse files Browse the repository at this point in the history
  • Loading branch information
jhkennedy committed Feb 2, 2024
1 parent 3455de4 commit 43a2444
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ This release accommodates changes to the HyP3 API schema introduced in HyP3 v6.0

### Changed
* `HyP3.my_info()`: A new `remaining_credits` field replaces the `quota` field in the return value
* `HyP3.check_quota` now returns a float instead of an integer if the user has processing credits
* `HyP3.check_quota` may return a float or an integer if the user has processing credits

### Deprecated
* `HyP3.check_quota` has been deprecated in favor of `hyp3.check_credits`
Expand Down
4 changes: 2 additions & 2 deletions src/hyp3_sdk/hyp3.py
Original file line number Diff line number Diff line change
Expand Up @@ -488,15 +488,15 @@ def my_info(self) -> dict:
_raise_for_hyp3_status(response)
return response.json()

def check_credits(self) -> Optional[float]:
def check_credits(self) -> Union[float, int, None]:
"""
Returns:
Your remaining processing credits, or None if you have no processing limit
"""
info = self.my_info()
return info['remaining_credits']

def check_quota(self) -> Optional[float]:
def check_quota(self) -> Union[float, int, None]:
"""Deprecated method for checking your remaining processing credits; replaced by `HyP3.check_credits`
Returns:
Expand Down

0 comments on commit 43a2444

Please sign in to comment.