Skip to content

Commit

Permalink
replace filter of tuple with _dropint for compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
kleinhenz committed Aug 26, 2020
1 parent 6ba3e83 commit 15f4e96
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/HDF5.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1308,6 +1308,11 @@ function getindex(dset::HDF5Dataset, I...)
read(dset, T, I...)
end

# could be replaced by filter(i -> !isa(i, Int), args) in julia 1.4
_dropint(x::Int, args...) = _dropint(args...)
_dropint(x::AbstractRange, args...) = (x, _dropint(args...)...)
_dropint() = ()

# generic read function
function read(obj::DatasetOrAttribute, ::Type{T}, I...) where T
!isconcretetype(T) && error("type $T is not concrete")
Expand Down Expand Up @@ -1342,7 +1347,7 @@ function read(obj::DatasetOrAttribute, ::Type{T}, I...) where T
elseif isempty(I)
sz, _ = get_dims(dspace)
else
sz = map(length, filter(i -> !isa(i, Int), indices))
sz = map(length, _dropint(indices...))
if isempty(sz)
sz = (1,)
scalar = true
Expand Down

0 comments on commit 15f4e96

Please sign in to comment.