Skip to content

Commit

Permalink
Update to pylint 2.13 (quantumlib#5156)
Browse files Browse the repository at this point in the history
Review: @mpharrigan
  • Loading branch information
maffoo authored Mar 29, 2022
1 parent 3066ef4 commit 0907ff2
Show file tree
Hide file tree
Showing 19 changed files with 27 additions and 27 deletions.
4 changes: 2 additions & 2 deletions cirq/circuits/circuit.py
Original file line number Diff line number Diff line change
Expand Up @@ -1359,7 +1359,7 @@ def zip(
same moment index.
Args:
circuits: The circuits to merge together.
*circuits: The circuits to merge together.
align: The alignment for the zip, see `cirq.Alignment`.
Returns:
Expand Down Expand Up @@ -1441,7 +1441,7 @@ def tetris_concat(
False
Args:
circuits: The circuits to concatenate.
*circuits: The circuits to concatenate.
align: When to stop when sliding the circuits together.
'left': Stop when the starts of the circuits align.
'right': Stop when the ends of the circuits align.
Expand Down
2 changes: 1 addition & 1 deletion cirq/circuits/circuit_operation.py
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ def with_qubits(self, *new_qubits: 'cirq.Qid') -> 'cirq.CircuitOperation':
"""Returns a copy of this operation with an updated qubit mapping.
Args:
new_qubits: A list of qubits to target. Qubits in this list are
*new_qubits: A list of qubits to target. Qubits in this list are
matched to qubits in the circuit following default qubit order,
ignoring any existing qubit map.
Expand Down
2 changes: 1 addition & 1 deletion cirq/circuits/moment.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def with_operations(self, *contents: 'cirq.OP_TREE') -> 'cirq.Moment':
"""Returns a new moment with the given contents added.
Args:
contents: New operations to add to this moment.
*contents: New operations to add to this moment.
Returns:
The new moment.
Expand Down
6 changes: 3 additions & 3 deletions cirq/devices/named_topologies.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def draw_gridlike(
ax: Optional matplotlib axis to use for drawing.
tilted: If True, directly position as (row, column); otherwise,
rotate 45 degrees to accommodate google-style diagonal grids.
kwargs: Additional arguments to pass to `nx.draw_networkx`.
**kwargs: Additional arguments to pass to `nx.draw_networkx`.
Returns:
A positions dictionary mapping nodes to (x, y) coordinates suitable for future calls
Expand Down Expand Up @@ -126,7 +126,7 @@ def draw(self, ax=None, tilted: bool = True, **kwargs) -> Dict[Any, Tuple[int, i
Args:
ax: Optional matplotlib axis to use for drawing.
tilted: If True, draw as a horizontal line. Otherwise, draw on a diagonal.
kwargs: Additional arguments to pass to `nx.draw_networkx`.
**kwargs: Additional arguments to pass to `nx.draw_networkx`.
"""
g2 = nx.relabel_nodes(self.graph, {n: (n, 1) for n in self.graph.nodes})
return draw_gridlike(g2, ax=ax, tilted=tilted, **kwargs)
Expand Down Expand Up @@ -217,7 +217,7 @@ def draw(self, ax=None, tilted=True, **kwargs):
ax: Optional matplotlib axis to use for drawing.
tilted: If True, directly position as (row, column); otherwise,
rotate 45 degrees to accommodate the diagonal nature of this topology.
kwargs: Additional arguments to pass to `nx.draw_networkx`.
**kwargs: Additional arguments to pass to `nx.draw_networkx`.
"""
return draw_gridlike(self.graph, ax=ax, tilted=tilted, **kwargs)

Expand Down
2 changes: 1 addition & 1 deletion cirq/experiments/qubit_characterizations.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def plot(self, axes: Optional[List[plt.Axes]] = None, **plot_kwargs: Any) -> Lis
axes: A list of 2 `plt.Axes` instances. Note that they must be in
3d projections. If not given, a new figure is created with 2
axes and the plotted figure is shown.
plot_kwargs: The optional kwargs passed to bar3d.
**plot_kwargs: The optional kwargs passed to bar3d.
Returns:
the list of `plt.Axes` being plotted on.
Expand Down
2 changes: 1 addition & 1 deletion cirq/linalg/decompositions.py
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ def scatter_plot_normalized_kak_interaction_coefficients(
wireframe. Defaults to `True`.
ax: A matplotlib 3d axes object to plot into. If not specified, a new
figure is created, plotted, and shown.
kwargs: Arguments forwarded into the call to `scatter` that plots the
**kwargs: Arguments forwarded into the call to `scatter` that plots the
points. Working arguments include color `c='blue'`, scale `s=2`,
labelling `label="theta=pi/4"`, etc. For reference see the
`matplotlib.pyplot.scatter` documentation:
Expand Down
2 changes: 1 addition & 1 deletion cirq/ops/arithmetic_operation.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def with_registers(self: TSelf, *new_registers: Union[int, Sequence['cirq.Qid']]
"""Returns the same operation targeting different registers.
Args:
new_registers: The new values that should be returned by the
*new_registers: The new values that should be returned by the
`registers` method.
Returns:
Expand Down
2 changes: 1 addition & 1 deletion cirq/ops/fourier_transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def qft(
equivalently `cirq.inverse(cirq.qft(*qubits))`.
Args:
qubits: The qubits to apply the qft to.
*qubits: The qubits to apply the qft to.
without_reverse: When set, swap gates at the end of the qft are omitted.
This reverses the qubit order relative to the standard qft effect,
but makes the gate cheaper to apply.
Expand Down
2 changes: 1 addition & 1 deletion cirq/ops/pauli_string_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1311,7 +1311,7 @@ def test_pauli_string_expectation_from_density_matrix_pure_state_with_coef():
z0z2 = cirq.Z(qs[0]) * cirq.Z(qs[2]) * -1
z1x2 = -cirq.Z(qs[1]) * cirq.X(qs[2])

for state in [rho, rho.reshape(2, 2, 2, 2, 2, 2, 2, 2)]:
for state in [rho, rho.reshape((2, 2, 2, 2, 2, 2, 2, 2))]:
np.testing.assert_allclose(z0z1.expectation_from_density_matrix(state, q_map), -0.123)
np.testing.assert_allclose(z0z2.expectation_from_density_matrix(state, q_map), 0)
np.testing.assert_allclose(z1x2.expectation_from_density_matrix(state, q_map), 1)
Expand Down
8 changes: 4 additions & 4 deletions cirq/ops/raw_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ def with_qubits(self: TSelf, *new_qubits: 'cirq.Qid') -> TSelf:
"""Returns the same operation, but applied to different qubits.
Args:
new_qubits: The new qubits to apply the operation to. The order must
*new_qubits: The new qubits to apply the operation to. The order must
exactly match the order of qubits returned from the operation's
`qubits` property.
"""
Expand Down Expand Up @@ -489,7 +489,7 @@ def with_tags(self, *new_tags: Hashable) -> 'cirq.Operation':
also restrict the operation to be JSON serializable.
Args:
new_tags: The tags to wrap this operation in.
*new_tags: The tags to wrap this operation in.
"""
if not new_tags:
return self
Expand Down Expand Up @@ -529,7 +529,7 @@ def controlled_by(
are specified, returns self.
Args:
control_qubits: Qubits to control the operation by. Required.
*control_qubits: Qubits to control the operation by. Required.
control_values: For which control qubit values to apply the
operation. A sequence of the same length as `control_qubits`
where each entry is an integer (or set of integers)
Expand Down Expand Up @@ -627,7 +627,7 @@ def with_classical_controls(
since tags are considered a local attribute.
Args:
conditions: A list of measurement keys, strings that can be parsed
*conditions: A list of measurement keys, strings that can be parsed
into measurement keys, or sympy expressions where the free
symbols are measurement key strings.
Expand Down
2 changes: 1 addition & 1 deletion cirq/optimizers/merge_interactions_to_sqrt_iswap_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def assert_optimizes(before: cirq.Circuit, expected: cirq.Circuit, **kwargs):
Args:
before: The input circuit to optimize.
expected: The expected result of optimization to compare against.
kwargs: Any extra arguments to pass to the
**kwargs: Any extra arguments to pass to the
``MergeInteractionsToSqrtIswap`` constructor.
"""
actual = before.copy()
Expand Down
4 changes: 2 additions & 2 deletions cirq/protocols/decompose_protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,10 +279,10 @@ def decompose_once(val: Any, default=RaiseTypeErrorIfNotProvided, *args, **kwarg
`_decompose_` method or that method returns `NotImplemented` or
`None`. If not specified, non-decomposable values cause a
`TypeError`.
args: Positional arguments to forward into the `_decompose_` method of
*args: Positional arguments to forward into the `_decompose_` method of
`val`. For example, this is used to tell gates what qubits they are
being applied to.
kwargs: Keyword arguments to forward into the `_decompose_` method of
**kwargs: Keyword arguments to forward into the `_decompose_` method of
`val`.
Returns:
Expand Down
2 changes: 1 addition & 1 deletion cirq/qis/states.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ def infer_qid_shape(*states: 'cirq.QUANTUM_STATE_LIKE') -> Tuple[int, ...]:
an error is raised.
Args:
states: The states for which to infer the qid shape.
*states: The states for which to infer the qid shape.
Returns:
The inferred qid shape.
Expand Down
2 changes: 1 addition & 1 deletion cirq/testing/deprecation.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def assert_deprecated(*msgs: str, deadline: str, count: Optional[int] = 1) -> It
>>> # do something deprecated
Args:
msgs: messages that should match the warnings captured
*msgs: messages that should match the warnings captured
deadline: the expected deadline the feature will be deprecated by. Has to follow the format
vX.Y (minor versions only)
count: if None count of messages is not asserted, otherwise the number of deprecation
Expand Down
2 changes: 1 addition & 1 deletion cirq/testing/equals_tester.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def make_equality_group(self, *factories: Callable[[], Any]):
Adds the objects as a group.
Args:
factories: Methods for producing independent copies of an item.
*factories: Methods for producing independent copies of an item.
Raises:
AssertionError: The factories produce items not equal to the others,
Expand Down
2 changes: 1 addition & 1 deletion cirq/testing/logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def assert_logs(
can be done beyond these simple asserts.
Args:
matches: Each of these is checked to see if they match, as a substring,
*matches: Each of these is checked to see if they match, as a substring,
any of the captures log messages.
count: The expected number of messages in logs. Defaults to 1. If None is passed in counts
are not checked.
Expand Down
2 changes: 1 addition & 1 deletion cirq/testing/order_tester.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def add_ascending_equivalence_group(self, *group_items: Any):
Adds the objects as a group.
Args:
group_items: items making the equivalence group
*group_items: items making the equivalence group
Raises:
AssertionError: The group elements aren't equal to each other,
Expand Down
2 changes: 1 addition & 1 deletion cirq/value/measurement_key_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

def test_empty_init():
with pytest.raises(TypeError, match='required positional argument'):
_ = cirq.MeasurementKey()
_ = cirq.MeasurementKey() # pylint: disable=no-value-for-parameter
with pytest.raises(ValueError, match='valid string'):
_ = cirq.MeasurementKey(None)
with pytest.raises(ValueError, match='valid string'):
Expand Down
4 changes: 2 additions & 2 deletions cirq/vis/heatmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ def plot(
Args:
ax: the Axes to plot on. If not given, a new figure is created,
plotted on, and shown.
kwargs: The optional keyword arguments are used to temporarily
**kwargs: The optional keyword arguments are used to temporarily
override the values present in the heatmap config. See
__init__ for more details on the allowed arguments.
Returns:
Expand Down Expand Up @@ -384,7 +384,7 @@ def plot(
Args:
ax: the Axes to plot on. If not given, a new figure is created,
plotted on, and shown.
kwargs: The optional keyword arguments are used to temporarily
**kwargs: The optional keyword arguments are used to temporarily
override the values present in the heatmap config. See
__init__ for more details on the allowed arguments.
Returns:
Expand Down

0 comments on commit 0907ff2

Please sign in to comment.