Performs the operation __repr__.
(self: Array, /)
| 100 | return self._array.__str__().replace("array", "Array") |
| 101 | |
| 102 | def __repr__(self: Array, /) -> str: |
| 103 | """ |
| 104 | Performs the operation __repr__. |
| 105 | """ |
| 106 | suffix = f", dtype={self.dtype.name})" |
| 107 | if 0 in self.shape: |
| 108 | prefix = "empty(" |
| 109 | mid = str(self.shape) |
| 110 | else: |
| 111 | prefix = "Array(" |
| 112 | mid = np.array2string(self._array, separator=', ', prefix=prefix, suffix=suffix) |
| 113 | return prefix + mid + suffix |
| 114 | |
| 115 | # This function is not required by the spec, but we implement it here for |
| 116 | # convenience so that np.asarray(np.array_api.Array) will work. |
nothing calls this directly
no outgoing calls
no test coverage detected