(self, cast_type)
| 1890 | __nonzero__ = __bool__ # python 2 |
| 1891 | |
| 1892 | def _scalarfunc(self, cast_type): |
| 1893 | if self.size > 1: |
| 1894 | raise TypeError("Only length-1 arrays can be converted to Python scalars") |
| 1895 | else: |
| 1896 | return cast_type(self.compute().item()) |
| 1897 | |
| 1898 | def __int__(self): |
| 1899 | return self._scalarfunc(int) |
no test coverage detected