Skip to content
Snippets Groups Projects
Commit 080690ed authored by François  LAURENT's avatar François LAURENT
Browse files

pushdependency! checks for duplicates (larvatagger.jl#97)

parent e31e84c0
No related branches found
No related tags found
No related merge requests found
Pipeline #97926 passed
...@@ -1221,7 +1221,12 @@ end ...@@ -1221,7 +1221,12 @@ end
function pushdependency!(run::Run, datafile::String) function pushdependency!(run::Run, datafile::String)
if haskey(run.attributes, :dependencies) if haskey(run.attributes, :dependencies)
deps = object_or_array_of_objects(run.attributes[:dependencies]) deps = object_or_array_of_objects(run.attributes[:dependencies])
push!(deps, as_dependency(datafile)) dep = as_dependency(datafile)
if (deps isa Vector && dep in deps) || dep == deps
@debug "Dependency already registered" dependency=dep
else
push!(deps, dep)
end
run.attributes[:dependencies] = deps run.attributes[:dependencies] = deps
else else
run.attributes[:dependencies] = as_dependency(datafile) run.attributes[:dependencies] = as_dependency(datafile)
......
...@@ -520,13 +520,13 @@ function load!(file::FIMTrack) ...@@ -520,13 +520,13 @@ function load!(file::FIMTrack)
framerate=file.framerate, framerate=file.framerate,
pixelsize=file.pixelsize, pixelsize=file.pixelsize,
kwargs...)) kwargs...))
metadata = get!(file.run.attributes, :metadata, OrderedDict{Symbol, Any}()) metadata = get!(OrderedDict{Symbol, Any}, file.run.attributes, :metadata)
camera = get!(metadata, :camera, OrderedDict{Symbol, Any}()) camera = get!(OrderedDict{Symbol, Any}, metadata, :camera)
camera[:framerate] = file.framerate camera[:framerate] = file.framerate
if !isnothing(file.pixelsize) if !isnothing(file.pixelsize)
camera[:pixelsize] = file.pixelsize camera[:pixelsize] = file.pixelsize
end end
units = get!(file.run.attributes, :units, OrderedDict{Symbol, String}()) units = get!(OrderedDict{Symbol, String}, file.run.attributes, :units)
units[:t] = "s" units[:t] = "s"
units[:framerate] = "fps" units[:framerate] = "fps"
if !isnothing(file.pixelsize) if !isnothing(file.pixelsize)
...@@ -594,7 +594,7 @@ function labelledfiles(repository::String=".", chunks::Bool=false; ...@@ -594,7 +594,7 @@ function labelledfiles(repository::String=".", chunks::Bool=false;
push!(files′, file′) push!(files′, file′)
if file′ isa JSONLabels if file′ isa JSONLabels
for dep in getdependencies(file′) for dep in getdependencies(file′)
push!(get!(deps, dep, JSONLabels[]), file′) push!(get!(()->JSONLabels[], deps, dep), file′)
end end
end end
end end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment