Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

better data handling #1033

Merged
merged 1 commit into from
Aug 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/DataBlobs/services/BlobPacking.jl
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ function unpackBlob(::Type{format"JSON"}, blob::Vector{UInt8})
return String(copy(blob))
end

unpackBlob(entry::BlobEntry, blob::Vector{UInt8}) = unpackBlob(entry.mimeType, blob)
unpackBlob(eb::Pair{<:BlobEntry, Vector{UInt8}}) = unpackBlob(eb[1], eb[2])


# 2/ FileIO
function packBlob(::Type{T}, data::Any; kwargs...) where T <: DataFormat
Expand Down
6 changes: 5 additions & 1 deletion src/DataBlobs/services/HelpersDataWrapEntryBlob.jl
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,12 @@ function getData(
lbls = (s->s.label).(de_)
idx = sortperm(lbls; rev=getlast)
_first(s) = s
_first(s::AbstractVector) = s[1]
_first(s::AbstractVector) = 0 < length(s) ? s[1] : nothing
de = _first(de_[idx])
if isnothing(de)
@error "Could not find in $vlabel the key $key"
return nothing
end
db = getBlob(dfg, de)

checkhash && assertHash(de, db, hashfunction=hashfunction)
Expand Down
Loading