Skip to content

Commit dec6d9b

Browse files
authored
Use f-strings in the pr_monitor tool (quantumlib#6208)
* pr_monitor - convert to f-strings to satisfy pylint consider-using-f-string * clean up some redundant fixed strings concatenations * also pin pytest-cov==3 to unblock CI coverage check which failed because pytest-cov==4.1.0 does not see line hits in a subprocess. Finalizes quantumlib#6171
1 parent cc9913b commit dec6d9b

File tree

3 files changed

+3
-4
lines changed

3 files changed

+3
-4
lines changed

cirq/_compat_test.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -781,8 +781,7 @@ def test_deprecated_module_deadline_validation():
781781

782782
def _test_broken_module_1_inner():
783783
with pytest.raises(
784-
DeprecatedModuleImportError,
785-
match="missing_module cannot be imported. " "The typical reasons",
784+
DeprecatedModuleImportError, match="missing_module cannot be imported. The typical reasons"
786785
):
787786
# pylint: disable=unused-import
788787
import cirq.testing._compat_test_data.broken_ref as br # type: ignore

cirq/qis/measures.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ def _numpy_arrays_to_state_vectors_or_density_matrices(
211211
state2.shape[0] if state2.ndim == 2 else np.prod(state2.shape, dtype=np.int64).item()
212212
)
213213
if dim1 != dim2:
214-
raise ValueError('Mismatched dimensions in given states: ' f'{dim1} and {dim2}.')
214+
raise ValueError(f'Mismatched dimensions in given states: {dim1} and {dim2}.')
215215
if qid_shape is None:
216216
qid_shape = (dim1,)
217217
else:

cirq/qis/states.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ def density_matrix(
314314
ValueError: Invalid density matrix.
315315
"""
316316
if state.ndim != 2 or state.shape[0] != state.shape[1]:
317-
raise ValueError('A density matrix must be a square matrix. ' f'Got shape {state.shape}.')
317+
raise ValueError(f'A density matrix must be a square matrix. Got shape {state.shape}.')
318318
dim, _ = state.shape
319319
if qid_shape is None:
320320
qid_shape = _infer_qid_shape_from_dimension(dim)

0 commit comments

Comments
 (0)