Skip to content

Commit

Permalink
fix: fixing suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
BrunoLiegiBastonLiegi committed Feb 26, 2024
1 parent 689b683 commit bb0da07
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/qibo/_openqasm.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@

from typing import Union

import numpy as np
import openqasm3

import qibo
from qibo.config import raise_error
from qibo.gates import FusedGate


class DefinedGate:
Expand Down Expand Up @@ -145,7 +147,7 @@ def _get_qubit(self, qubit):

def _get_gate(self, gate):
"""Converts a :class:`openqasm3.ast.QuantumGate` statement
into :class:`qibo.gates.measurements.M`."""
into :class:`qibo.gates.Gate`."""
qubits = [self._get_qubit(q) for q in gate.qubits]
init_args = []
for arg in gate.arguments:
Expand All @@ -155,6 +157,7 @@ def _get_gate(self, gate):
except:
pass
init_args.append(arg)
# check whether the gate exists in qibo.gates already
try:
gates = [
getattr(qibo.gates, _qibo_gate_name(gate.name.name))(
Expand All @@ -163,6 +166,7 @@ def _get_gate(self, gate):
]
except:
try:
# check whether the gate was defined by the user
gates = self.defined_gates.get(gate.name.name).get_gates(
qubits, init_args
)
Expand Down

0 comments on commit bb0da07

Please sign in to comment.