Skip to content

Commit

Permalink
Fix 0.7 depwarns (#444)
Browse files Browse the repository at this point in the history
  • Loading branch information
yuyichao authored and musm committed Sep 21, 2017
1 parent c8a043d commit 7cae2b4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion REQUIRE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
julia 0.5
BinDeps 0.6.0
Blosc
Compat 0.27.0
Compat 0.32.0
@osx Homebrew 0.3.1
@windows WinRPM
22 changes: 11 additions & 11 deletions src/HDF5.jl
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,7 @@ function h5read(filename, name::String)
dat
end

function h5read(filename, name::String, indices::Tuple{Vararg{Union{Range{Int},Int,Colon}}})
function h5read(filename, name::String, indices::Tuple{Vararg{Union{AbstractRange{Int},Int,Colon}}})
local dat
fid = h5open(filename, "r")
try
Expand Down Expand Up @@ -1667,7 +1667,7 @@ write{T<:ScalarOrString}(parent::Union{HDF5File, HDF5Group}, name::String, data:
write{T<:ScalarOrString}(parent::HDF5Dataset, name::String, data::Union{T, Array{T}}, plists...) = a_write(parent, name, data, plists...)

# Reading arrays using getindex: data = dset[:,:,10]
function getindex(dset::HDF5Dataset, indices::Union{Range{Int},Int}...)
function getindex(dset::HDF5Dataset, indices::Union{AbstractRange{Int},Int}...)
local T
dtype = datatype(dset)
try
Expand All @@ -1677,7 +1677,7 @@ function getindex(dset::HDF5Dataset, indices::Union{Range{Int},Int}...)
end
_getindex(dset,T, indices...)
end
function _getindex(dset::HDF5Dataset, T::Type, indices::Union{Range{Int},Int}...)
function _getindex(dset::HDF5Dataset, T::Type, indices::Union{AbstractRange{Int},Int}...)
if !(T<:HDF5Scalar)
error("Dataset indexing (hyperslab) is available only for bits types")
end
Expand All @@ -1696,11 +1696,11 @@ function _getindex(dset::HDF5Dataset, T::Type, indices::Union{Range{Int},Int}...
end

# Write to a subset of a dataset using array slices: dataset[:,:,10] = array
function setindex!(dset::HDF5Dataset, X::Array, indices::Union{Range{Int},Int}...)
function setindex!(dset::HDF5Dataset, X::Array, indices::Union{AbstractRange{Int},Int}...)
T = hdf5_to_julia(dset)
_setindex!(dset, T, X, indices...)
end
function _setindex!(dset::HDF5Dataset,T::Type, X::Array, indices::Union{Range{Int},Int}...)
function _setindex!(dset::HDF5Dataset,T::Type, X::Array, indices::Union{AbstractRange{Int},Int}...)
if !(T<:Array)
error("Dataset indexing (hyperslab) is available only for arrays")
end
Expand All @@ -1726,7 +1726,7 @@ function _setindex!(dset::HDF5Dataset,T::Type, X::Array, indices::Union{Range{In
end
X
end
function setindex!(dset::HDF5Dataset, X::AbstractArray, indices::Union{Range{Int},Int}...)
function setindex!(dset::HDF5Dataset, X::AbstractArray, indices::Union{AbstractRange{Int},Int}...)
T = hdf5_to_julia(dset)
if !(T<:Array)
error("Hyperslab interface is available only for arrays")
Expand All @@ -1735,7 +1735,7 @@ function setindex!(dset::HDF5Dataset, X::AbstractArray, indices::Union{Range{Int
setindex!(dset, Y, indices...)
end

function setindex!(dset::HDF5Dataset, x::Number, indices::Union{Range{Int},Int}...)
function setindex!(dset::HDF5Dataset, x::Number, indices::Union{AbstractRange{Int},Int}...)
T = hdf5_to_julia(dset)
if !(T<:Array)
error("Hyperslab interface is available only for arrays")
Expand All @@ -1744,10 +1744,10 @@ function setindex!(dset::HDF5Dataset, x::Number, indices::Union{Range{Int},Int}.
setindex!(dset, X, indices...)
end

getindex(dset::HDF5Dataset, I::Union{Range{Int},Int,Colon}...) = getindex(dset, ntuple(i-> isa(I[i], Colon) ? (1:size(dset,i)) : I[i], length(I))...)
setindex!(dset::HDF5Dataset, x, I::Union{Range{Int},Int,Colon}...) = setindex!(dset, x, ntuple(i-> isa(I[i], Colon) ? (1:size(dset,i)) : I[i], length(I))...)
getindex(dset::HDF5Dataset, I::Union{AbstractRange{Int},Int,Colon}...) = getindex(dset, ntuple(i-> isa(I[i], Colon) ? (1:size(dset,i)) : I[i], length(I))...)
setindex!(dset::HDF5Dataset, x, I::Union{AbstractRange{Int},Int,Colon}...) = setindex!(dset, x, ntuple(i-> isa(I[i], Colon) ? (1:size(dset,i)) : I[i], length(I))...)

function hyperslab(dset::HDF5Dataset, indices::Union{Range{Int},Int}...)
function hyperslab(dset::HDF5Dataset, indices::Union{AbstractRange{Int},Int}...)
local dsel_id
dspace = dataspace(dset)
try
Expand All @@ -1766,7 +1766,7 @@ function hyperslab(dset::HDF5Dataset, indices::Union{Range{Int},Int}...)
dsel_start[k] = index-1
dsel_stride[k] = 1
dsel_count[k] = 1
elseif isa(index, Range)
elseif isa(index, AbstractRange)
dsel_start[k] = first(index)-1
dsel_stride[k] = step(index)
dsel_count[k] = length(index)
Expand Down

0 comments on commit 7cae2b4

Please sign in to comment.