MCPcopy Create free account
hub / github.com/dask/dask / _scalarfunc

Method _scalarfunc

dask/array/core.py:1892–1896  ·  view source on GitHub ↗
(self, cast_type)

Source from the content-addressed store, hash-verified

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)

Callers 4

__int__Method · 0.95
__float__Method · 0.95
__complex__Method · 0.95
__index__Method · 0.95

Calls 1

computeMethod · 0.95

Tested by

no test coverage detected