Skip to content

Commit db0fba5

Browse files
committed
minor: small code simplication
1 parent 1ae1568 commit db0fba5

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

pylops_mpi/DistributedArray.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ class DistributedArray:
7979
axis : :obj:`int`, optional
8080
Axis along which distribution occurs. Defaults to ``0``.
8181
local_shapes : :obj:`list`, optional
82-
List of tuples of integers representing local shapes at each rank.
82+
List of tuples or integers representing local shapes at each rank.
8383
engine : :obj:`str`, optional
8484
Engine used to store array (``numpy`` or ``cupy``)
8585
dtype : :obj:`str`, optional
@@ -106,8 +106,7 @@ def __init__(self, global_shape: Union[Tuple, Integral],
106106
self._partition = partition
107107
self._axis = axis
108108

109-
if local_shapes is not None:
110-
local_shapes = [_value_or_sized_to_tuple(local_shape) for local_shape in local_shapes]
109+
local_shapes = local_shapes if local_shapes is None else [_value_or_sized_to_tuple(local_shape) for local_shape in local_shapes]
111110
self._check_local_shapes(local_shapes)
112111
self._local_shape = local_shapes[base_comm.rank] if local_shapes else local_split(global_shape, base_comm,
113112
partition, axis)

0 commit comments

Comments
 (0)