MCPcopy
hub / github.com/dask/dask / _scalarfunc

Method _scalarfunc

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

Source from the content-addressed store, hash-verified

1886 __nonzero__ = __bool__ # python 2
1887
1888 def _scalarfunc(self, cast_type):
1889 if self.size > 1:
1890 raise TypeError("Only length-1 arrays can be converted to Python scalars")
1891 else:
1892 return cast_type(self.compute().item())
1893
1894 def __int__(self):
1895 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