Skip to content

Add complete type hints to SubscriptionHandle - #2564

Closed
as7111771-create wants to merge 1 commit into
hiero-ledger:mainfrom
as7111771-create:fix/add-type-hints-subscription-handle
Closed

Add complete type hints to SubscriptionHandle#2564
as7111771-create wants to merge 1 commit into
hiero-ledger:mainfrom
as7111771-create:fix/add-type-hints-subscription-handle

Conversation

@as7111771-create

Copy link
Copy Markdown

Description

This PR adds complete type hints to the SubscriptionHandle class in src/hiero_sdk_python/utils/subscription_handle.py, as requested in #2560.

(This is a re-open of #2562 — the previous PR was accidentally closed when the branch was recreated with DCO sign-off and GPG signing as requested by @danielmarv.)

Changes

This is a types-only change — no method bodies or behavior are modified.

  • Added -> None return annotation to __init__
  • Added -> None return annotation to _set_call (kept existing call: Any param annotation)
  • Added -> None return annotation to cancel
  • Added -> None return annotation to set_thread (kept existing thread: threading.Thread param annotation)
  • Updated join(self, timeout=None)join(self, timeout: float | None = None) -> None
    • Used float | None since the value passes directly to threading.Thread.join(timeout), which takes seconds as a float or None
    • Added a Google-style Args: docstring block for timeout
  • is_cancelled was already fully annotated — left unchanged

Conventions

Follows the typing conventions in docs/sdk_developers/types.md:

  • PEP 604 union syntax (float | None) over Optional[float]
  • Inline type hints over repeating types in docstrings
  • The file already has from __future__ import annotations at the top, so this union syntax works on Python 3.10

DCO & GPG Sign-off

Commit includes:

  • Signed-off-by: Samir <as7111771-create@users.noreply.github.com> (DCO)
  • GPG signature

Closes #2560

@coderabbitai

coderabbitai Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 99e03e4f-cd1a-424c-9ea6-e83b93cf995f

📥 Commits

Reviewing files that changed from the base of the PR and between 0faf324 and 1f8c6fd.

📒 Files selected for processing (1)
  • src/hiero_sdk_python/utils/subscription_handle.py

Included review availability: Your plan includes up to 1 review per rolling hour; 0 remain after this review.


Walkthrough

SubscriptionHandle now has complete type annotations for its constructor and methods. The join method specifies an optional timeout and documents indefinite waiting. Runtime behavior remains unchanged.

Changes

SubscriptionHandle typing

Layer / File(s) Summary
Complete method annotations
src/hiero_sdk_python/utils/subscription_handle.py
The constructor, _set_call, and cancel methods now declare None returns. set_thread declares threading.Thread input and a None return. join declares an optional float timeout and a None return. Its documentation describes timeout behavior.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Merge Risk: ⚪ Minimal · up to 1f8c6

This localized change adds type hints without modifying runtime behavior, so no actionable merge-blocking risk remains beyond normal checks and review.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes satisfy issue #2560 by adding the requested annotations and timeout documentation without changing behavior.
Out of Scope Changes check ✅ Passed The changes remain limited to the requested SubscriptionHandle annotations and documentation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed The title clearly and concisely identifies the main change: adding complete type hints to SubscriptionHandle.
Description check ✅ Passed The description directly explains the type annotation changes, documentation update, scope, and related issue.
📋 Issue Planner

Built with CodeRabbit's Coding Plans for faster development and fewer bugs.

View plan used: #2560

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

Add `-> None` return annotations to `__init__`, `_set_call`, `cancel`,
and `set_thread`. Update `join` signature to use
`timeout: float | None = None) -> None`.

This is a types-only change — no method bodies or behavior modified.
Follows the typing conventions in docs/sdk_developers/types.md
(PEP 604 union syntax, inline type hints).

Closes hiero-ledger#2560

Signed-off-by: Samir <as7111771-create@users.noreply.github.com>
@github-actions github-actions Bot added open to community review PR is open for community review and feedback queue:junior-committer PR awaiting initial quality review labels Aug 18, 2026
@manishdait

Copy link
Copy Markdown
Contributor

@as7111771-create, thanks for the PR! It looks like the GPG signature on this commit couldn’t be verified. Could you please check and re-sign the commit? Thanks!

@github-actions github-actions Bot added approved Issue has been approved by team member Good First Issue Issues which are ideal for a first time or new project contributor. labels Aug 18, 2026
@codecov

codecov Bot commented Aug 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #2564   +/-   ##
=======================================
  Coverage   95.44%   95.44%           
=======================================
  Files         165      165           
  Lines       10557    10557           
=======================================
  Hits        10076    10076           
  Misses        481      481           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@aceppaluni aceppaluni left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Happy to review when changes are addressed.

Please let us know if you need assistance :)

@aceppaluni aceppaluni changed the title Add complete type hints to SubscriptionHandle (DCO + GPG signed) Add complete type hints to SubscriptionHandle Aug 19, 2026
@aceppaluni aceppaluni added status: update branch developer needs to click update branch and removed approved Issue has been approved by team member labels Aug 19, 2026
@github-actions

Copy link
Copy Markdown
Requesting triage review from: @hiero-ledger/hiero-sdk-python-triage

@github-actions

Copy link
Copy Markdown

Hi there! I'm the LinkedIssueBot.
This pull request has been automatically closed due to the following reason(s):

Thank you,
From Python SDK team

@github-actions github-actions Bot closed this Aug 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Good First Issue Issues which are ideal for a first time or new project contributor. open to community review PR is open for community review and feedback queue:junior-committer PR awaiting initial quality review status: update branch developer needs to click update branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add complete type hints to SubscriptionHandle

5 participants