From 39fa648bc8a0b7b8cf1659463373be2699202c7f Mon Sep 17 00:00:00 2001 From: Illviljan <14371165+Illviljan@users.noreply.github.com> Date: Tue, 3 Sep 2024 00:56:15 +0200 Subject: [PATCH] Update _utils.py --- xarray/namedarray/_array_api/_utils.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/xarray/namedarray/_array_api/_utils.py b/xarray/namedarray/_array_api/_utils.py index 86b7db892cd..7e08400d4c4 100644 --- a/xarray/namedarray/_array_api/_utils.py +++ b/xarray/namedarray/_array_api/_utils.py @@ -283,15 +283,19 @@ def _get_broadcasted_dims(*arrays: NamedArray[Any, Any]) -> tuple[_Dims, _Shape] dims = tuple(a.dims for a in arrays) shapes = tuple(a.shape for a in arrays) - out_dims: tuple[_Dim, ...] = () - out_shape: tuple[_Axis | None, ...] = () + out_dims: _Dims = () + out_shape: _Shape = () for d, sizes in zip( zip_longest(*map(reversed, dims), fillvalue=_default), zip_longest(*map(reversed, shapes), fillvalue=-1), ): _d = tuple(set(d) - {_default}) - dim = None if any(_isnone(sizes)) else max(sizes) + if any(_isnone(sizes)): + # dim = None + raise NotImplementedError("TODO: Handle None in shape, {shapes = }") + else: + dim = max(sizes) if any(i not in [-1, 0, 1, dim] for i in sizes) or len(_d) != 1: raise ValueError(