From 8c59fb86c00aa9aa2da42bbe67ee094f9f23551c Mon Sep 17 00:00:00 2001 From: Francesco Ballarin Date: Sat, 23 Nov 2024 07:59:46 +0100 Subject: [PATCH] Parenthesize the and subexpression in an expression that also contains or, as suggested by the new ruff rule RUF021 --- rbnicsx/_backends/tensors_array.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rbnicsx/_backends/tensors_array.py b/rbnicsx/_backends/tensors_array.py index d94ddb8..cf960c4 100644 --- a/rbnicsx/_backends/tensors_array.py +++ b/rbnicsx/_backends/tensors_array.py @@ -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