Skip to content

Commit

Permalink
Merge pull request #1033 from JuliaRobotics/23Q3/enh/betterdata
Browse files Browse the repository at this point in the history
better data handling
  • Loading branch information
dehann authored Aug 16, 2023
2 parents 8756d25 + ade35e3 commit 17f63da
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
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

0 comments on commit 17f63da

Please sign in to comment.