(
data: Any,
coords: (
Sequence[Sequence | pd.Index | DataArray | Variable | np.ndarray]
| Mapping
| None
),
dims: str | Iterable[Hashable] | None,
)
| 196 | |
| 197 | |
| 198 | def _check_data_shape( |
| 199 | data: Any, |
| 200 | coords: ( |
| 201 | Sequence[Sequence | pd.Index | DataArray | Variable | np.ndarray] |
| 202 | | Mapping |
| 203 | | None |
| 204 | ), |
| 205 | dims: str | Iterable[Hashable] | None, |
| 206 | ) -> Any: |
| 207 | if data is dtypes.NA: |
| 208 | data = np.nan |
| 209 | if coords is not None and utils.is_scalar(data, include_0d=False): |
| 210 | if utils.is_dict_like(coords): |
| 211 | if dims is None: |
| 212 | return data |
| 213 | else: |
| 214 | data_shape = tuple( |
| 215 | ( |
| 216 | as_variable(coords[k], k, auto_convert=False).size |
| 217 | if k in coords.keys() |
| 218 | else 1 |
| 219 | ) |
| 220 | for k in dims |
| 221 | ) |
| 222 | else: |
| 223 | data_shape = tuple( |
| 224 | as_variable(coord, "foo", auto_convert=False).size for coord in coords |
| 225 | ) |
| 226 | data = np.full(data_shape, data) |
| 227 | return data |
| 228 | |
| 229 | |
| 230 | class _LocIndexer(Generic[T_DataArray]): |
no test coverage detected
searching dependent graphs…