Skip to content

Commit

Permalink
remove default values of InternalGate (#6330)
Browse files Browse the repository at this point in the history
  • Loading branch information
NoureldinYosri authored Oct 26, 2023
1 parent 235a0c6 commit 1549785
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 13 deletions.
2 changes: 1 addition & 1 deletion cirq-google/cirq_google/json_test_data/InternalGate.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"cirq_type": "InternalGate",
"gate_name": "CouplerDelayZ",
"gate_module": "pyle.cirqtools.pyle_gates",
"gate_module": "internal.module",
"num_qubits": 2,
"delay": 1,
"zpa": 0.0,
Expand Down
2 changes: 1 addition & 1 deletion cirq-google/cirq_google/json_test_data/InternalGate.repr
Original file line number Diff line number Diff line change
@@ -1 +1 @@
cirq_google.InternalGate(gate_name="CouplerDelayZ", gate_module="pyle.cirqtools.pyle_gates", num_qubits=2, delay=1, zpa=0.0, zpl=None)
cirq_google.InternalGate(gate_name="CouplerDelayZ", gate_module="internal.module", num_qubits=2, delay=1, zpa=0.0, zpl=None)
10 changes: 2 additions & 8 deletions cirq-google/cirq_google/ops/internal_gate.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,12 @@ class InternalGate(ops.Gate):
constructor stored in `self.gate_args`.
"""

def __init__(
self,
gate_name: str,
gate_module: str = 'pyle.cirqtools.pyle_gates',
num_qubits: int = 1,
**kwargs,
):
def __init__(self, gate_name: str, gate_module: str, num_qubits: int = 1, **kwargs):
"""Instatiates an InternalGate.
Arguments:
gate_name: Gate class name.
gate_module: The module of the gate (defualt: pyle.cirqtools.pyle_gates).
gate_module: The module of the gate.
num_qubits: Number of qubits that the gate acts on.
**kwargs: The named arguments to be passed to the gate constructor.
"""
Expand Down
6 changes: 3 additions & 3 deletions cirq-google/cirq_google/ops/internal_gate_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@
def test_internal_gate():
g = cirq_google.InternalGate(
gate_name="CouplerDelayZ",
gate_module='pyle.cirqtools.pyle_gates',
gate_module='internal_module',
num_qubits=2,
delay=1,
zpa=0.0,
zpl=None,
)
assert str(g) == 'pyle.cirqtools.pyle_gates.CouplerDelayZ(delay=1, zpa=0.0, zpl=None)'
assert str(g) == 'internal_module.CouplerDelayZ(delay=1, zpa=0.0, zpl=None)'
want_repr = (
"cirq_google.InternalGate(gate_name='CouplerDelayZ', "
"gate_module='pyle.cirqtools.pyle_gates', num_qubits=2, "
"gate_module='internal_module', num_qubits=2, "
"delay=1, zpa=0.0, zpl=None)"
)
assert repr(g) == want_repr
Expand Down

0 comments on commit 1549785

Please sign in to comment.