Skip to content

chore: implement __repr__ method for FileId class (#1628)#1770

Merged
exploreriii merged 5 commits intohiero-ledger:mainfrom
Subhrasameerdash:chore/fileid-repr-1628
Feb 11, 2026
Merged

chore: implement __repr__ method for FileId class (#1628)#1770
exploreriii merged 5 commits intohiero-ledger:mainfrom
Subhrasameerdash:chore/fileid-repr-1628

Conversation

@Subhrasameerdash
Copy link
Contributor

Description:
Summary

  • Implements a custom repr method for the FileId class that returns a clean, constructor-style representation suitable for debugging.

What Changed

  • Added repr() method to FileId class in file_id.py

  • Returns format: FileId(shard=X, realm=Y, file=Z)

  • Excludes the checksum field to keep output clean

  • Provides a constructor-style representation for better debugging experience

  • Added unit tests in file_id_test.py

  • test_repr_representation() - tests default values

  • test_repr_representation_custom_values() - tests custom values

  • Updated CHANGELOG.md with the new feature entry in the Added section

Related issue(s):

Fixes #1628

Notes for reviewer:

  • All 34 existing FileId tests pass ✅
  • 2 new repr tests pass ✅
  • No breaking changes to existing functionality

Checklist

Signed-off-by: SubhraSameerDash <2303105_cseai@gita.edu.in>
@Subhrasameerdash Subhrasameerdash requested a review from a team as a code owner February 9, 2026 17:28
Copilot AI review requested due to automatic review settings February 9, 2026 17:28
@Subhrasameerdash Subhrasameerdash requested a review from a team as a code owner February 9, 2026 17:28
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 9, 2026

Walkthrough

Adds a custom repr to FileId returning constructor-style strings without checksum (e.g., "FileId(shard=0, realm=0, file=150)"), includes unit tests for the new representation, and updates the changelog.

Changes

Cohort / File(s) Summary
FileId __repr__ Implementation
src/hiero_sdk_python/file/file_id.py, CHANGELOG.md
Added def __repr__(self) -> str to FileId to return FileId(shard=X, realm=Y, file=Z). Added changelog entry documenting the change.
FileId Representation Tests
tests/unit/file_id_test.py
Added unit tests asserting repr(FileId(...)) for default and custom values.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'chore: implement repr method for FileId class' clearly and concisely summarizes the main change of adding a repr method to FileId.
Description check ✅ Passed The description is clearly related to the changeset, detailing the repr implementation, format, test additions, and CHANGELOG update for the FileId class.
Linked Issues check ✅ Passed All requirements from issue #1628 are met: custom repr implemented returning 'FileId(shard=X, realm=Y, file=Z)' format, checksum excluded, unit tests added, and CHANGELOG updated.
Out of Scope Changes check ✅ Passed All changes are directly related to implementing the repr method and its tests; no out-of-scope modifications detected.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

No actionable comments were generated in the recent review. 🎉

Tip

We've launched Issue Planner and it is currently in beta. Please try it out and share your feedback on Discord!


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Implements a custom __repr__ for FileId to provide a cleaner, constructor-style debug representation (and records the change in the changelog), addressing the debugging ergonomics requested in #1628.

Changes:

  • Added FileId.__repr__() returning FileId(shard=..., realm=..., file=...).
  • Added unit tests asserting the new repr(FileId(...)) output.
  • Updated CHANGELOG.md under Added to document the feature.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/hiero_sdk_python/file/file_id.py Adds __repr__() for clearer debugging output.
tests/unit/file_id_test.py Adds assertions for FileId’s new __repr__() output.
CHANGELOG.md Documents the new FileId.__repr__ feature in Unreleased/Added.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Subhrasameerdash Subhrasameerdash marked this pull request as draft February 10, 2026 11:03
@Subhrasameerdash Subhrasameerdash changed the title feat: implement __repr__ method for FileId class (#1628) chore: implement __repr__ method for FileId class (#1628) Feb 10, 2026
@Subhrasameerdash Subhrasameerdash marked this pull request as ready for review February 10, 2026 11:06
@github-actions
Copy link

Hi, this is MergeConflictBot.
Your pull request cannot be merged because it contains merge conflicts.

Please resolve these conflicts locally and push the changes.

Quick Fix for CHANGELOG.md Conflicts

If your conflict is only in CHANGELOG.md, you can resolve it easily using the GitHub web editor:

  1. Click on the "Resolve conflicts" button in the PR
  2. Accept both changes (keep both changelog entries)
  3. Click "Mark as resolved"
  4. Commit the merge

For all other merge conflicts, please read:

Thank you for contributing!

Signed-off-by: Subhra Sameer Dash <170787407+Subhrasameerdash@users.noreply.github.com>
Copy link
Contributor

@aceppaluni aceppaluni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Subhrasameerdash This is looking great, thank you!

Once the AI/coderabbit suggestions are implemented will take another look.

Thank you and happy contributing!

@aceppaluni aceppaluni added the status: needs developer revision PR has requested changes that the developer needs to implement label Feb 10, 2026
Copy link
Contributor

@exploreriii exploreriii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I think this is good to go once the merge conflict is solved.
@aceppaluni the code rabbit feedback in this case is proposing something going against the issue description, so we can safely ignore it in this case

Signed-off-by: Subhra Sameer Dash <170787407+Subhrasameerdash@users.noreply.github.com>
@github-actions
Copy link

Hello, this is the OfficeHourBot.

This is a reminder that the Hiero Python SDK Office Hours are scheduled in approximately 4 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,
The Python SDK Team

@codecov
Copy link

codecov bot commented Feb 11, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1770   +/-   ##
=======================================
  Coverage   93.29%   93.29%           
=======================================
  Files         141      141           
  Lines        9116     9118    +2     
=======================================
+ Hits         8505     8507    +2     
  Misses        611      611           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@exploreriii exploreriii dismissed aceppaluni’s stale review February 11, 2026 11:08

requested changes do not apply in this case

@exploreriii exploreriii merged commit 14942a3 into hiero-ledger:main Feb 11, 2026
20 checks passed
@exploreriii
Copy link
Contributor

Thank you @Subhrasameerdash !

@github-actions
Copy link

🎉 Nice work completing a Beginner issue!

Thank you for your contribution to the Hiero Python SDK! We're excited to have you as part of our community.

Here are some Good First Issue issues at a similar level you might be interested in working on next:

  1. [Good First Issue]: Update Office Hours with direct link instead of the general calendar

    🆕🐥 Newcomer Friendly This Good First Issue is a guided, well-scoped task intended for new contributors to the Hiero Python SDK. #### What yo...

  2. [Good First Issue]: Add Missing Docstring to compress_point_unchecked Function

    🆕🐥 Newcomer Friendly This Good First Issue is a guided, well-scoped task intended for new contributors to the Hiero Python SDK. #### What you...

  3. [Good First Issue]: Refactor file_create_transaction.py to use Client.from_env\(\)

    🆕🐥 Newcomer Friendly This Good First Issue is a guided, well-scoped task intended for new contributors to the Hiero Python SDK. #### What you...

  4. [Good First Issue]: format black tests/unit/endpoint_test.py

    🆕🐥 First Timers Only This issue is reserved for people who have never contributed or have made minimal contributions to Hiero Python SDK. We kno...

🌟 Stay connected with the project:

We look forward to seeing more contributions from you! If you have any questions, feel free to ask in our Discord community.

From the Hiero Python SDK Team 🚀

@Subhrasameerdash
Copy link
Contributor Author

Thank you @exploreriii for being patient with me.

This pr was challenging and I enjoyed it a lot

@exploreriii
Copy link
Contributor

That's really nice to hear.
Thank you for your message and sharing your experience 🥇

om12prakash pushed a commit to om12prakash/hiero-sdk-python that referenced this pull request Feb 11, 2026
…hiero-ledger#1770)

Signed-off-by: SubhraSameerDash <2303105_cseai@gita.edu.in>
Signed-off-by: Subhra Sameer Dash <170787407+Subhrasameerdash@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: awaiting merge status: needs developer revision PR has requested changes that the developer needs to implement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Beginner]: Implement __repr__ Method for FileId Class

3 participants