Skip to content

Move QASM 2 printing into its own module - #454

Open
danielgaskins wants to merge 1 commit into
qBraid:mainfrom
danielgaskins:refactor/qasm2-printer
Open

danielgaskins wants to merge 1 commit into
qBraid:mainfrom
danielgaskins:refactor/qasm2-printer

Conversation

@danielgaskins

@danielgaskins danielgaskins commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Summary of changes

Moves Qasm2Printer and branch normalization into modules/qasm2_printer.py, leaving qasm2.py at 230 lines. Validation and printing still share the same normalization; the module now calls a named validation function.

Normalized branches have named fields instead of a tuple. The printer reads register sizes from the program, and its existing explicit-size arguments still work.

Closes #447.

All 1,006 tests pass with three existing skips. Before/after comparisons match exactly for serialized branches, validation errors and transformation results. Black, isort, Pylint, mypy, license headers and the Sphinx build with warnings treated as errors all pass.

Fresh wheel and source-distribution installs each pass the same 1,006-test suite (three existing skips).

Signed-off-by: Daniel Gaskins <danielgaskins99@gmail.com>
@argus-eye

argus-eye Bot commented Oct 14, 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: 2
  • Diff lines (±): 723
  • Historical avg: ~350.7k tokens · ~$1.38 · across last 13 review(s)

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

@github-actions

Copy link
Copy Markdown
Contributor

👋 Hey there! It looks like the changelog might need an update.

Please take a moment to edit the CHANGELOG.md with:

  • A brief, one-to-two sentence summary of your changes.
  • A link back to this PR for reference.
  • (Optional) A small working example if you've added new features.

@coderabbitai

coderabbitai Bot commented Oct 14, 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: Repository: qBraid/pyqasm/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1e0b8823-64fe-4712-9fa5-4b7a0c41802c

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
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

This branch has not been deployed

No deployments
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.

Move the QASM 2 printer and its branch pre-processing out of qasm2.py

1 participant