Skip to content

Commit

Permalink
remove extra User-Agent prefix in the ionq API header (#6232)
Browse files Browse the repository at this point in the history
* remove the extra User-Agent prefix

* require ionq User-Agent starts with "cirq/"

---------

Co-authored-by: Pavol Juhas <juhas@google.com>
  • Loading branch information
splch and pavoljuhas authored Aug 23, 2023
1 parent 999fd94 commit 6abc740
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 6 deletions.
2 changes: 1 addition & 1 deletion cirq-ionq/cirq_ionq/ionq_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ def _user_agent(self):
"""
cirq_version_string = f'cirq/{cirq_version}'
python_version_string = f'python/{platform.python_version()}'
return f'User-Agent: {cirq_version_string} ({python_version_string})'
return f'{cirq_version_string} ({python_version_string})'

def _target(self, target: Optional[str]) -> str:
"""Returns the target if not None or the default target.
Expand Down
1 change: 1 addition & 0 deletions cirq-ionq/cirq_ionq/ionq_client_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ def test_ionq_client_attributes():
'Content-Type': 'application/json',
'User-Agent': client._user_agent(),
}
assert client.headers['User-Agent'].startswith('cirq/')
assert client.default_target == 'qpu'
assert client.max_retry_seconds == 10
assert client.verbose is True
Expand Down
5 changes: 0 additions & 5 deletions cirq-ionq/cirq_ionq/ionq_devices_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,3 @@ def test_validate_circuit_valid():
gate_domain={gate: gate.num_qubits() for gate in VALID_GATES},
)
device.validate_circuit(circuit)


def test_decompose_operation_deprecated():
with cirq.testing.assert_deprecated('Use cirq.optimize_for_target_gateset', deadline='v0.16'):
_ = ionq.decompose_to_device(cirq.CZ(*cirq.LineQubit.range(2)))

0 comments on commit 6abc740

Please sign in to comment.