feat: add arithmetic operators to Hbar#2286
Conversation
Signed-off-by: Emmanuel Nwajari <De_real_iManuel@hotmail.com>
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughThe ChangesHbar Arithmetic Operators
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 📋 Issue PlannerBuilt with CodeRabbit's Coding Plans for faster development and fewer bugs. View plan used: ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: bb7eac1d-43bd-4b44-a6fa-9bf51abb74ec
📒 Files selected for processing (2)
src/hiero_sdk_python/hbar.pytests/unit/hbar_test.py
…ests Signed-off-by: Emmanuel Nwajari <De_real_iManuel@hotmail.com>
|
Addressed, I added isinstance checks and additional edge case tests in the follow-up commit. |
|
|
||
| def __add__(self, other: object) -> Hbar: | ||
| """ | ||
| Return a new Hbar representing the sum of this and another Hbar. |
There was a problem hiding this comment.
I am not certain if the doc strings are clear here. Should we update @De-real-iManuel ?
|
|
||
| def __sub__(self, other: object) -> Hbar: | ||
| """ | ||
| Return a new Hbar representing the difference of this and another Hbar. |
|
Hello, this is the OfficeHourBot. This is a reminder that the Hiero Python SDK Office Hours will begin in approximately 3 hours (14:00 UTC). This session provides an opportunity to ask questions regarding this Pull Request. Details:
Disclaimer: This is an automated reminder. Please verify the schedule here for any changes. From, |
|
@De-real-iManuel, thanks for the PR and the work on this! At the moment, adding arithmetic operators to |
exploreriii
left a comment
There was a problem hiding this comment.
Hi @De-real-iManuel
When you have some time, would you mind creating an issue here https://github.com/hiero-ledger/sdk-collaboration-hub/issues outlining your proposal.
This way it can be rolled out across the SDKs and we support similar services
Meanwhile as this is in discussion, I am converting this to draft
Summary
Adds
__add__,__sub__, and__abs__dunder methods to theHbarclass, enabling native Python arithmetic syntax for HBAR amounts.Changes
__add__,__sub__,__abs__tosrc/hiero_sdk_python/hbar.pyNotImplementedfor non-Hbar operands)tests/unit/hbar_test.pycovering basic operations, type errors, and edge casesFixes #2274