Skip to content

Commit

Permalink
Fix a missing import and some mypy errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jond01 committed May 20, 2022
1 parent 80f2919 commit 43bd829
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions quantum-viz/quantum_viz/widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""quantum-viz Viewer is a Jupyter Widget that displays the quantum-viz.js circuit
visualizer.
""" # noqa: D400, D205
import json
import uuid
from enum import Enum
from typing import Any
Expand Down Expand Up @@ -81,8 +82,12 @@ def __init__(
self.name = "_"

if not isinstance(circuit, dict):
from .qiskit_parser import qiskit2dict
from .qiskit_parser import qiskit2dict, QuantumCircuit

if not isinstance(circuit, QuantumCircuit):
raise TypeError(
f"Received a circuit of an unsupported type: {type(circuit)}"
)
circuit = qiskit2dict(circuit)

self.width = width
Expand Down Expand Up @@ -129,7 +134,7 @@ def html_str(self, uid: Optional[str] = None) -> str:
def _ipython_display_(self) -> None:
"""Display the widget with IPython."""
viewer = HTML(self.html_str())
display(viewer)
display((viewer,))

def browser_display(self) -> None:
"""Display the widget in the browser."""
Expand Down

0 comments on commit 43bd829

Please sign in to comment.