Skip to content

docs(base): fix incorrect device_qubits kwarg in QasmModule.unroll() docstring - #349

Merged
ryanhill1 merged 4 commits into
qBraid:mainfrom
sathichaitanyasaidurga:docs-unroll-kwargs-device-qubits
Aug 7, 2026
Merged

docs(base): fix incorrect device_qubits kwarg in QasmModule.unroll() docstring#349
ryanhill1 merged 4 commits into
qBraid:mainfrom
sathichaitanyasaidurga:docs-unroll-kwargs-device-qubits

Conversation

@sathichaitanyasaidurga

@sathichaitanyasaidurga sathichaitanyasaidurga commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Related to #89, but does not close it -- #89 asks for the documented
kwargs to become explicit named parameters on unroll(), which is a
larger, separate change. This PR only corrects the existing docstring
to be accurate.

QasmModule.unroll()'s docstring lists device_qubits as a supported
**kwargs entry, but unroll() forwards kwargs directly to
QasmVisitor.init(), which has no device_qubits parameter.
Calling module.unroll(device_qubits=5) raises:

TypeError: QasmVisitor.__init__() got an unexpected keyword argument 'device_qubits'

Device qubit validation is actually inferred automatically inside the
visitor, so it isn't something a caller can set through unroll().

Change:

  • Removed the incorrect device_qubits line from the unroll() docstring.
  • Added a Notes entry clarifying that device-qubit validation is inferred
    automatically, not configurable via unroll() kwargs.

Testing:

  • Reproduced the TypeError on main before this change to confirm the
    docstring was inaccurate.
  • Docstring-only change; no functional code touched.
  • black/isort pass; py_compile confirms no syntax errors.

device_qubits was documented as an accepted **kwargs entry for QasmModule.unroll(), but it is not a parameter of QasmVisitor.__init__ and passing it raises TypeError. Device qubit validation is inferred automatically during unrolling, not user-settable via unroll().

Fixes qBraid#89
@argus-eye

argus-eye Bot commented Aug 5, 2026

Copy link
Copy Markdown

Argus review

Auto-review is off for this repo. Tick the box below to run a review on this PR.

  • Trigger Argus review

Estimated cost

  • Files changed: 1
  • Diff lines (±): 6
  • Historical avg: ~318.9k tokens · ~$1.35 · across last 6 review(s)

Tip: you can also comment @argus-eye review at any time.

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: c4d71778-aa37-4b1b-9277-184ad204fd7a

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

@ryanhill1 ryanhill1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for this — the core fix is right. Confirmed QasmVisitor.__init__ has no device_qubits parameter and unroll(device_qubits=5) raises TypeError, and the five remaining documented kwargs all work, so the list is accurate once that line is gone.

Two things before merge:

  1. The replacement Notes text needs a correction — details inline.
  2. #89 asks for the kwargs to be promoted to explicit named parameters on unroll(), not just documented, so this doesn't close it as written. Either extend the PR to do that — very welcome, and the corrected docstring makes it straightforward — or drop the Closes #89 line from the description.

Comment thread src/pyqasm/modules/base.py
Comment thread CHANGELOG.md Outdated
device_qubits is set via loads(program, device_qubits=N), not unroll(). Auto-inference only applies when consolidate_qubits=True. Move changelog entry under Fixed per review.
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@ryanhill1
ryanhill1 merged commit 78a8408 into qBraid:main Aug 7, 2026
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants