DEV Community

Aubrey D
Aubrey D

Posted on

Hacktoberfest PR: Cleaning Up Code

Hacktoberfest: Contribution Chronicles

Issue
PR

hiero-sdk-python is a Python SDK for the Hiero blockchain — a toolkit that helps developers interact with smart contracts, tokens, and transactions through Python.
It’s structured a lot like the Hedera SDK, where each type of blockchain transaction (freeze, unfreeze, transfer, etc.) has its own class, all inheriting from a shared base class called Transaction.

This SDK has a clear focus on clean design and maintainability, which is why this issue existed in the first place. The issue described a small but important cleanup: the TokenUnfreezeTransaction class had some duplicate logic that was already implemented in its parent class. The goal was to remove the extra field and method, and update the internal calls to use the inherited _require_not_frozen() instead.

This one was pretty straightforward, but it needed careful attention to detail.

Here’s what I did:
1. Removed the line that declared _is_frozen in token_unfreeze_transaction.py.
2. Deleted the __require_not_frozen() method entirely.
3. Replaced all instances of self.__require_not_frozen() with self._require_not_frozen() to make sure the class now used the inherited version from Transaction.

Before this PR, I didn’t realize how important method naming conventions could be in large codebases. In Python, a double underscore method gets “name-mangled”, so it doesn’t behave exactly the same as a protected _method. That subtle difference can lead to bugs if you don’t notice it.

Top comments (0)