Skip to content

Commit

Permalink
run initial format(["src", "test"]) x2
Browse files Browse the repository at this point in the history
  • Loading branch information
t-bltg committed Aug 3, 2022
1 parent d7015a8 commit 5194686
Show file tree
Hide file tree
Showing 49 changed files with 4,825 additions and 4,064 deletions.
44 changes: 23 additions & 21 deletions src/HDF5.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,18 @@ import Mmap
### PUBLIC API ###

export
@read, @write,
h5open, h5read, h5write, h5rewrite, h5writeattr, h5readattr,
create_attribute, open_attribute, read_attribute, write_attribute, delete_attribute, rename_attribute, attributes, attrs,
create_dataset, open_dataset, read_dataset, write_dataset,
create_group, open_group,
copy_object, open_object, delete_object, move_link,
create_datatype, commit_datatype, open_datatype,
create_property,
group_info, object_info,
dataspace, datatype,
Filters, Drivers
@read, @write,
h5open, h5read, h5write, h5rewrite, h5writeattr, h5readattr,
create_attribute, open_attribute, read_attribute, write_attribute, delete_attribute,
rename_attribute, attributes, attrs,
create_dataset, open_dataset, read_dataset, write_dataset,
create_group, open_group,
copy_object, open_object, delete_object, move_link,
create_datatype, commit_datatype, open_datatype,
create_property,
group_info, object_info,
dataspace, datatype,
Filters, Drivers

### The following require module scoping ###

Expand Down Expand Up @@ -97,7 +98,8 @@ function h5read(filename, name_type_pair::Pair{<:AbstractString,DataType}; pv...
dat
end

function h5read(filename, name::AbstractString, indices::Tuple{Vararg{Union{AbstractRange{Int},Int,Colon}}}; pv...)
function h5read(filename, name::AbstractString,
indices::Tuple{Vararg{Union{AbstractRange{Int},Int,Colon}}}; pv...)
local dat
fapl = FileAccessProperties(; fclose_degree = :strong)
pv = setproperties!(fapl; pv...)
Expand All @@ -112,8 +114,6 @@ function h5read(filename, name::AbstractString, indices::Tuple{Vararg{Union{Abst
dat
end



function Base.getindex(parent::Union{File,Group}, path::AbstractString; pv...)
haskey(parent, path) || throw(KeyError(path))
# Faster than below if defaults are OK
Expand All @@ -136,7 +136,8 @@ end

# Assign syntax: obj[path] = value
# Create a dataset with properties: obj[path, prop = val, ...] = val
function Base.setindex!(parent::Union{File,Group}, val, path::Union{AbstractString,Nothing}; pv...)
function Base.setindex!(parent::Union{File,Group}, val, path::Union{AbstractString,Nothing};
pv...)
need_chunks = any(k in keys(chunked_props) for k in keys(pv))
have_chunks = any(k == :chunk for k in keys(pv))

Expand Down Expand Up @@ -172,7 +173,6 @@ get_create_properties(g::Group) = GroupCreateProperties(API.h5g_get_create_p
get_create_properties(f::File) = FileCreateProperties(API.h5f_get_create_plist(f))
get_create_properties(a::Attribute) = AttributeCreateProperties(API.h5a_get_create_plist(a))


const HAS_PARALLEL = Ref(false)

"""
Expand All @@ -196,12 +196,14 @@ function __init__()
ASCII_ATTRIBUTE_PROPERTIES.char_encoding = :ascii
UTF8_ATTRIBUTE_PROPERTIES.char_encoding = :utf8

@require FileIO="5789e2e9-d7fb-5bc7-8068-2c6fae9b9549" begin
@require OrderedCollections="bac558e1-5e72-5ebc-8fee-abe8a469f55d" include("fileio.jl")
end
@require FileIO="5789e2e9-d7fb-5bc7-8068-2c6fae9b9549" begin @require OrderedCollections="bac558e1-5e72-5ebc-8fee-abe8a469f55d" include("fileio.jl") end
@require H5Zblosc="c8ec2601-a99c-407f-b158-e79c03c2f5f7" begin
set_blosc!(p::Properties, val::Bool) = val && push!(Filters.FilterPipeline(p), H5Zblosc.BloscFilter())
set_blosc!(p::Properties, level::Integer) = push!(Filters.FilterPipeline(p), H5Zblosc.BloscFilter(level=level))
function set_blosc!(p::Properties, val::Bool)
val && push!(Filters.FilterPipeline(p), H5Zblosc.BloscFilter())
end
function set_blosc!(p::Properties, level::Integer)
push!(Filters.FilterPipeline(p), H5Zblosc.BloscFilter(; level = level))
end
end

return nothing
Expand Down
5 changes: 3 additions & 2 deletions src/api/error.jl
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,15 @@ function Base.showerror(io::IO, err::H5Error)
errval = unsafe_load(errptr)
print(io, "\n", lpad("[$n] ", 4 + ndigits(n_total)))
if errval.func_name != C_NULL
printstyled(io, unsafe_string(errval.func_name); bold=true)
printstyled(io, unsafe_string(errval.func_name); bold = true)
print(io, ": ")
end
major = h5e_get_msg(errval.maj_num)[2]
minor = h5e_get_msg(errval.min_num)[2]
print(io, major, "/", minor)
if errval.desc != C_NULL
printstyled(io, "\n", " "^(4 + ndigits(n_total)), unsafe_string(errval.desc), color=:light_black)
printstyled(io, "\n", " "^(4 + ndigits(n_total)), unsafe_string(errval.desc);
color = :light_black)
end
if SHORT_ERROR[]
if n_total > 1
Expand Down
Loading

0 comments on commit 5194686

Please sign in to comment.