Esempio n. 1
0
File: util.py Progetto: hengthu/zarr
def buffer_size(v):
    from array import array as _stdlib_array
    if PY2 and isinstance(v, _stdlib_array):  # pragma: py3 no cover
        # special case array.array because does not support buffer
        # interface in PY2
        return v.buffer_info()[1] * v.itemsize
    else:  # pragma: py2 no cover
        v = memoryview(v)
        return reduce(operator.mul, v.shape) * v.itemsize
Esempio n. 2
0
def buffer_size(v):
    from array import array as _stdlib_array
    if PY2 and isinstance(v, _stdlib_array):  # pragma: py3 no cover
        # special case array.array because does not support buffer
        # interface in PY2
        return v.buffer_info()[1] * v.itemsize
    else:  # pragma: py2 no cover
        v = memoryview(v)
        return reduce(operator.mul, v.shape) * v.itemsize
Esempio n. 3
0
File: core.py Progetto: will133/zarr
 def _nchunks(self):
     return reduce(operator.mul, self._cdata_shape)
Esempio n. 4
0
File: core.py Progetto: will133/zarr
 def _size(self):
     return reduce(operator.mul, self._shape)
Esempio n. 5
0
 def _nchunks(self):
     return reduce(operator.mul, self._cdata_shape)
Esempio n. 6
0
 def _size(self):
     return reduce(operator.mul, self._shape)