@@ -719,17 +719,19 @@ def fileslice(fileobj, sliceobj, shape, dtype, offset=0, order='C',
719
719
Parameters
720
720
----------
721
721
fileobj : file-like object
722
- binary file-like object. Implements ``read`` and ``seek``
722
+ file-like object, opened for reading in binary mode. Implements
723
+ ``read`` and ``seek``.
723
724
sliceobj : object
724
- something that can be used to slice an array as in ``arr[sliceobj]``
725
+ something that can be used to slice an array as in ``arr[sliceobj]``.
725
726
shape : sequence
726
- shape of full array inside `fileobj`
727
- dtype : dtype object
728
- dtype of array inside `fileobj`
727
+ shape of full array inside `fileobj`.
728
+ dtype : dtype specifier
729
+ dtype of array inside `fileobj`, or input to ``numpy.dtype`` to specify
730
+ array dtype.
729
731
offset : int, optional
730
732
offset of array data within `fileobj`
731
733
order : {'C', 'F'}, optional
732
- memory layout of array in `fileobj`
734
+ memory layout of array in `fileobj`.
733
735
heuristic : callable, optional
734
736
function taking slice object, axis length, stride length as arguments,
735
737
returning one of 'full', 'contiguous', None. See
@@ -743,7 +745,8 @@ def fileslice(fileobj, sliceobj, shape, dtype, offset=0, order='C',
743
745
"""
744
746
if is_fancy (sliceobj ):
745
747
raise ValueError ("Cannot handle fancy indexing" )
746
- itemsize = dtype .itemsize
748
+ dtype = np .dtype (dtype )
749
+ itemsize = int (dtype .itemsize )
747
750
segments , sliced_shape , post_slicers = calc_slicedefs (
748
751
sliceobj , shape , itemsize , offset , order )
749
752
n_bytes = reduce (operator .mul , sliced_shape , 1 ) * itemsize
0 commit comments