Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix lint in pylintrc #5952

Merged
merged 2 commits into from
Nov 22, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Clean redundant f-strings that show for fixed pylintrc
  • Loading branch information
pavoljuhas committed Nov 22, 2022
commit c6eed78eb8f62c4583af6d35d4bedac1b1ab9ca6
16 changes: 8 additions & 8 deletions cirq-core/cirq/circuits/circuit_operation_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ def test_string_format():

fc0 = cirq.FrozenCircuit()
op0 = cirq.CircuitOperation(fc0)
assert str(op0) == f"[ ]"
assert str(op0) == "[ ]"

fc0_global_phase_inner = cirq.FrozenCircuit(
cirq.global_phase_operation(1j), cirq.global_phase_operation(1j)
Expand All @@ -553,7 +553,7 @@ def test_string_format():
op0_global_phase_outer = cirq.CircuitOperation(fc0_global_phase_outer)
assert (
str(op0_global_phase_outer)
== f"""\
== """\
[ ]
[ ]
[ global phase: -0.5π ]"""
Expand All @@ -563,7 +563,7 @@ def test_string_format():
op1 = cirq.CircuitOperation(fc1)
assert (
str(op1)
== f"""\
== """\
[ 0: ───X───────M('m')─── ]
[ │ ]
[ 1: ───H───@───M──────── ]
Expand Down Expand Up @@ -599,10 +599,10 @@ def test_string_format():
)
assert (
str(op2)
== f"""\
== """\
[ 0: ───X───X─── ]
[ │ ]
[ 1: ───H───@─── ](qubit_map={{q(1): q(2)}}, parent_path=('outer', 'inner'),\
[ 1: ───H───@─── ](qubit_map={q(1): q(2)}, parent_path=('outer', 'inner'),\
repetition_ids=['a', 'b', 'c'])"""
)
assert (
Expand Down Expand Up @@ -635,9 +635,9 @@ def test_string_format():
indented_fc3_repr = repr(fc3).replace('\n', '\n ')
assert (
str(op3)
== f"""\
[ 0: ───X^b───M('m')─── ](qubit_map={{q(0): q(1)}}, \
key_map={{m: p}}, params={{b: 2}})"""
== """\
[ 0: ───X^b───M('m')─── ](qubit_map={q(0): q(1)}, \
key_map={m: p}, params={b: 2})"""
)
assert (
repr(op3)
Expand Down
2 changes: 1 addition & 1 deletion cirq-core/cirq/experiments/readout_confusion_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def __init__(
pattern.
"""
if len(measure_qubits) == 0:
raise ValueError(f"measure_qubits cannot be empty.")
raise ValueError("measure_qubits cannot be empty.")
if isinstance(confusion_matrices, np.ndarray):
confusion_matrices = [confusion_matrices]
measure_qubits = cast(
Expand Down
18 changes: 9 additions & 9 deletions cirq-core/cirq/qis/clifford_tableau.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,9 @@ def _reconstruct_rs(self, rs: Optional[np.ndarray]) -> np.ndarray:
new_rs = np.append(rs, np.zeros(1, dtype=bool))
else:
raise ValueError(
f"The value you passed for rs is not the correct shape and/or type. "
f"Please confirm that it's a single row with 2*num_qubits columns "
f"and of type bool."
"The value you passed for rs is not the correct shape and/or type. "
"Please confirm that it's a single row with 2*num_qubits columns "
"and of type bool."
)
return new_rs

Expand All @@ -196,9 +196,9 @@ def _reconstruct_xs(self, xs: Optional[np.ndarray]) -> np.ndarray:
new_xs = np.append(xs, np.zeros((1, self.n), dtype=bool), axis=0)
else:
raise ValueError(
f"The value you passed for xs is not the correct shape and/or type. "
f"Please confirm that it's 2*num_qubits rows, num_qubits columns, "
f"and of type bool."
"The value you passed for xs is not the correct shape and/or type. "
"Please confirm that it's 2*num_qubits rows, num_qubits columns, "
"and of type bool."
)
return new_xs

Expand All @@ -219,9 +219,9 @@ def _reconstruct_zs(self, zs: Optional[np.ndarray]) -> np.ndarray:
new_zs = np.append(zs, np.zeros((1, self.n), dtype=bool), axis=0)
else:
raise ValueError(
f"The value you passed for zs is not the correct shape and/or type. "
f"Please confirm that it's 2*num_qubits rows, num_qubits columns, "
f"and of type bool."
"The value you passed for zs is not the correct shape and/or type. "
"Please confirm that it's 2*num_qubits rows, num_qubits columns, "
"and of type bool."
)
return new_zs

Expand Down
2 changes: 1 addition & 1 deletion cirq-core/cirq/testing/circuit_compare.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ def assert_circuits_have_same_unitary_given_final_permutation(

if not set(qubit_map.keys()).issubset(actual.all_qubits()):
raise ValueError(
f"'qubit_map' must be a mapping of the qubits in the circuit 'actual' to themselves."
"'qubit_map' must be a mapping of the qubits in the circuit 'actual' to themselves."
)

actual_cp = actual.unfreeze()
Expand Down
2 changes: 1 addition & 1 deletion cirq-core/cirq/testing/routing_devices_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def test_allowed_multi_qubit_gates():
device.validate_operation(cirq.MeasurementGate(2).on(*cirq.LineQubit.range(2)))
device.validate_operation(cirq.MeasurementGate(3).on(*cirq.LineQubit.range(3)))

with pytest.raises(ValueError, match=f"Unsupported operation"):
with pytest.raises(ValueError, match="Unsupported operation"):
device.validate_operation(cirq.CCNOT(*cirq.LineQubit.range(3)))

device.validate_operation(cirq.CNOT(*cirq.LineQubit.range(2)))
Expand Down
2 changes: 1 addition & 1 deletion cirq-google/cirq_google/engine/engine_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def _verify_reps(
total_reps += len(list(cirq.to_resolvers(sweep))) * repetitions
if total_reps > max_repetitions:
raise RuntimeError(
f'No requested processors currently support the number of requested total repetitions.'
'No requested processors currently support the number of requested total repetitions.'
)


Expand Down
2 changes: 1 addition & 1 deletion cirq-google/cirq_google/engine/qcs_notebook.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def get_qcs_objects_for_notebook(
print("Authentication complete.")
except Exception as exc:
print(f"Authentication failed: {exc}")
print(f"Using virtual engine instead.")
print("Using virtual engine instead.")
virtual = True

if not virtual:
Expand Down