Skip to content

Fix long code lines in tutorials flagged in #5239#5338

Open
henryzou50 wants to merge 2 commits into
mainfrom
fix-long-lines
Open

Fix long code lines in tutorials flagged in #5239#5338
henryzou50 wants to merge 2 commits into
mainfrom
fix-long-lines

Conversation

@henryzou50

@henryzou50 henryzou50 commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

Summary

Addresses the content-side problems from #5239 by fixing code lines longer than 88 characters and overly wide text outputs in three tutorials. All changes pass squeaky --check, and where outputs were touched they were regenerated deterministically from the same data, so code and stored outputs remain consistent.

compilation-methods-for-hamiltonian-simulation-circuits

  • Split a 154-char benchpress URL using implicit string concatenation
  • Wrapped a 117-char comment across two lines
  • Refactored a long qubit-range f-string into min_qubits/max_qubits
    variables and split long P(|00...0>) print f-strings into fragments
    (printed text unchanged)

ai-transpiler-introduction

  • Wrapped long comments and print f-strings
  • Replaced the printed full qubit-count list with a range summary ("Created 20 circuits with qubit counts from 6 to 25") and updated the stored outputs to match (the output is fully determined by constants in the cell)

sml-classification

  • Built the dataset URLs from a base_url variable interpolated into the !wget commands (verified the interpolation produces the identical URL)
  • Switched the job metadata prints to pprint so the ~260-char resource_usage dict outputs wrap at 80 chars. Note this is likely what rendered badly online; stored outputs were regenerated by runningpprint on the same dicts

To do in this PR

  • Rerun dc-hex-ising to restore its missing output images

Wrap code lines exceeding 88 characters and shorten overly wide text
outputs in three tutorials flagged in #5239:

- compilation-methods-for-hamiltonian-simulation-circuits: split a
  154-char benchpress URL with implicit string concatenation, wrap a
  long comment, and break long print f-strings into fragments
  (printed text unchanged)
- ai-transpiler-introduction: wrap long comments and print f-strings;
  replace the printed full qubit-count list with a range summary
  ("from 6 to 25") and update the stored outputs to match
- sml-classification: build the dataset URLs from a base_url variable
  interpolated into the wget commands; pretty-print the job metadata
  dicts with pprint so the ~260-char output lines wrap at 80 chars
  (stored outputs regenerated from the same data)

A follow-up commit will rerun dc-hex-ising to restore its missing
output images.
@henryzou50 henryzou50 requested a review from a team July 6, 2026 15:45
@henryzou50 henryzou50 self-assigned this Jul 6, 2026
@qiskit-bot

Copy link
Copy Markdown
Contributor

One or more of the following people are relevant to this code:

@review-notebook-app

Copy link
Copy Markdown

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@kaelynj kaelynj mentioned this pull request Jul 9, 2026
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants