(x, ndim)
| 4337 | # or NUMPY_LICENSE.txt within this directory |
| 4338 | |
| 4339 | def atleast_nd(x, ndim): |
| 4340 | x = asanyarray(x) |
| 4341 | diff = max(ndim - x.ndim, 0) |
| 4342 | if diff == 0: |
| 4343 | return x |
| 4344 | else: |
| 4345 | return x[(None,) * diff + (Ellipsis,)] |
| 4346 | |
| 4347 | def format_index(index): |
| 4348 | return "arrays" + "".join(f"[{i}]" for i in index) |
no test coverage detected