(value, include_0d)
| 367 | |
| 368 | |
| 369 | def _is_scalar(value, include_0d): |
| 370 | from xarray.core.variable import NON_NUMPY_SUPPORTED_ARRAY_TYPES |
| 371 | |
| 372 | if include_0d: |
| 373 | include_0d = getattr(value, "ndim", None) == 0 |
| 374 | return ( |
| 375 | include_0d |
| 376 | or isinstance(value, str | bytes) |
| 377 | or not ( |
| 378 | isinstance(value, (Iterable,) + NON_NUMPY_SUPPORTED_ARRAY_TYPES) |
| 379 | or hasattr(value, "__array_function__") |
| 380 | or hasattr(value, "__array_namespace__") |
| 381 | ) |
| 382 | ) |
| 383 | |
| 384 | |
| 385 | def is_scalar(value: Any, include_0d: bool = True) -> TypeGuard[Hashable]: |
no outgoing calls
no test coverage detected
searching dependent graphs…