Skip to content

Commit 8e51f2a

Browse files
committed
Small tweaks
1 parent 7a6fb08 commit 8e51f2a

5 files changed

Lines changed: 7 additions & 7 deletions

File tree

cirq-core/cirq/contrib/paulistring/pauli_string_measurement_with_readout_mitigation.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -588,15 +588,14 @@ def measure_pauli_strings(
588588
normalized_circuits_to_pauli = _normalize_input_paulis(circuits_to_pauli)
589589

590590
# Extract unique qubit tuples from input pauli strings
591-
unique_qubit_tuples = set()
592591
if measure_on_full_support:
593592
full_support: set[ops.Qid] = set()
594593
for pauli_string_groups in normalized_circuits_to_pauli.values():
595594
for pauli_strings in pauli_string_groups:
596595
for pauli_string in pauli_strings:
597596
full_support.update(pauli_string.qubits)
598597
# One calibration group
599-
unique_qubit_tuples.add(tuple(sorted(full_support)))
598+
unique_qubit_tuples = {tuple(sorted(full_support))}
600599
else:
601600
unique_qubit_tuples = {
602601
tuple(_extract_readout_qubits(pauli_strings))

cirq-core/cirq/ops/phased_x_gate_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ def test_exponent_consistency(exponent, phase_exponent) -> None:
261261
"""Verifies that instances of PhasedX gate expose consistent exponents."""
262262
g = cirq.PhasedXPowGate(exponent=exponent, phase_exponent=phase_exponent)
263263
assert g.exponent in [exponent, -exponent]
264-
assert g.phase_exponent == [cirq.value.canonicalize_half_turns(g.phase_exponent)]
264+
assert g.phase_exponent == cirq.value.canonicalize_half_turns(g.phase_exponent)
265265

266266
g2 = cirq.PhasedXPowGate(exponent=g.exponent, phase_exponent=g.phase_exponent)
267267
assert g == g2

cirq-web/cirq_web/widget.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,6 @@ def _to_script_tag(bundle_filename: str) -> str:
117117
Returns:
118118
The bundle file as string (readable by browser) wrapped in HTML script tags.
119119
"""
120-
bundle_file_path = os.path.join(_DIST_PATH, bundle_filename)
121-
bundle_file_contents = Path(bundle_file_path).read_text(encoding='utf-8')
120+
bundle_file_path = _DIST_PATH.joinpath(bundle_filename)
121+
bundle_file_contents = bundle_file_path.read_text(encoding='utf-8')
122122
return f'<script>{bundle_file_contents}</script>'

dev_tools/codeowners_test.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ def test_codeowners(filepath, expected) -> None:
8888
# will be skipped
8989
codeowners = pytest.importorskip("codeowners")
9090

91-
owners = codeowners.CodeOwners(pathlib.Path(".github/CODEOWNERS").read_text(encoding="utf8"))
91+
owners_text = pathlib.Path(".github/CODEOWNERS").read_text(encoding="utf8")
92+
owners = codeowners.CodeOwners(owners_text)
9293
assert os.path.exists(
9394
filepath
9495
), f"{filepath} should exist to avoid creating/maintaining meaningless codeowners rules."

dev_tools/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def _check_for_reuse_or_recreate(env_dir: Path):
113113
def _create_base_env(base_dir: Path, pip_install_args: tuple[str, ...]):
114114
try:
115115
create_virtual_env(str(base_dir), [], sys.executable, True)
116-
Path(base_dir / "testrun.uid").write_text(testrun_uid, encoding="utf8")
116+
base_dir.joinpath("testrun.uid").write_text(testrun_uid, encoding="utf8")
117117
if pip_install_args:
118118
shell_tools.run([f"{base_dir}/bin/pip", "install", *pip_install_args])
119119
except BaseException as ex:

0 commit comments

Comments
 (0)