Skip to content

Commit

Permalink
Parenthesize the and subexpression in an expression that also contain…
Browse files Browse the repository at this point in the history
…s or, as suggested by the new ruff rule RUF021
  • Loading branch information
francesco-ballarin committed Nov 23, 2024
1 parent 2c3a2ed commit 8c59fb8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions rbnicsx/_backends/tensors_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,9 @@ def __getitem__( # type: ignore[no-any-unimported]
Tensor at position `key` if `key` is an integer, otherwise TensorsArray obtained by
storing every element at the indices in the slice `key`.
"""
if isinstance(key, int) or isinstance(key, tuple) and all([isinstance(key_, int) for key_ in key]):
if isinstance(key, int) or (isinstance(key, tuple) and all([isinstance(key_, int) for key_ in key])):
return self._array[key]
elif isinstance(key, slice) or isinstance(key, tuple) and all([isinstance(key_, slice) for key_ in key]):
elif isinstance(key, slice) or (isinstance(key, tuple) and all([isinstance(key_, slice) for key_ in key])):
output_array = self._array[key]
output = self.duplicate(output_array.shape)
output._array = output_array
Expand Down

0 comments on commit 8c59fb8

Please sign in to comment.