예제 #1
0
파일: util.py 프로젝트: 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
예제 #2
0
파일: util.py 프로젝트: pombredanne/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
예제 #3
0
파일: core.py 프로젝트: will133/zarr
 def _nchunks(self):
     return reduce(operator.mul, self._cdata_shape)
예제 #4
0
파일: core.py 프로젝트: will133/zarr
 def _size(self):
     return reduce(operator.mul, self._shape)
예제 #5
0
파일: core.py 프로젝트: alimanfoo/zarr
 def _nchunks(self):
     return reduce(operator.mul, self._cdata_shape)
예제 #6
0
파일: core.py 프로젝트: alimanfoo/zarr
 def _size(self):
     return reduce(operator.mul, self._shape)