Skip to content

Commit aa122dc

Browse files
authored
Cleanup some old deprecations (#1094)
1 parent 8070d63 commit aa122dc

File tree

13 files changed

+43
-124
lines changed

13 files changed

+43
-124
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "DistributedFactorGraphs"
22
uuid = "b5cc3c7e-6572-11e9-2517-99fb8daf2f04"
3-
version = "0.25.0"
3+
version = "0.24.1"
44

55
[deps]
66
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"

src/FileDFG/services/FileDFG.jl

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ function loadDFG!(
9898
dfgLoadInto::AbstractDFG,
9999
dst::AbstractString;
100100
overwriteDFGMetadata::Bool = true,
101-
useDeprExtract::Bool = false,
102101
)
103102

104103
#
@@ -130,24 +129,16 @@ function loadDFG!(
130129
@info "loadDFG! detected a gzip $dstname -- unpacking via $loaddir now..."
131130
Base.rm(folder; recursive = true, force = true)
132131
# unzip the tar file
133-
134-
# TODO deprecated, remove. Kept for legacy support if older tarbals
135-
if useDeprExtract
136-
@warn "Old FileDFG compressed tar files are deprecated, load with useDeprExtract=true and use saveDFG again to update"
137-
run(`tar -zxf $dstname -C $loaddir`)
138-
else
139-
tar_gz = open(dstname)
140-
tar = CodecZlib.GzipDecompressorStream(tar_gz)
141-
Tar.extract(tar, folder)
142-
close(tar)
143-
end
144-
132+
tar_gz = open(dstname)
133+
tar = CodecZlib.GzipDecompressorStream(tar_gz)
134+
Tar.extract(tar, folder)
135+
close(tar)
145136
#or for non-compressed
146137
# Tar.extract(dstname, folder)
147138
end
148139

149140
#GraphsDFG metadata
150-
if overwriteDFGMetadata && !useDeprExtract
141+
if overwriteDFGMetadata
151142
@assert isa(dfgLoadInto, GraphsDFG) "Only GraphsDFG metadata are supported"
152143
@info "loading dfg metadata"
153144
jstr = read("$folder/dfg.json", String)

src/GraphsDFG/FactorGraphs/FactorGraphs.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,8 @@ function addFactor!(
140140

141141
for vlabel in variableLabels
142142
!haskey(g.labels, vlabel) && (
143-
@error "Variable '$(vlabel)' not found in graph when creating Factor '$(factor.label)'"; return false
143+
throw(KeyError(vlabel))
144+
# @error "Variable '$(vlabel)' not found in graph when creating Factor '$(factor.label)'"; return false
144145
) #TODO debug error or exception?
145146
end
146147

src/entities/AbstractDFGSummary.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
$(TYPEDEF)
33
Structure for a graph summary.
44
"""
5-
65
struct DFGSummary
76
variables::Dict{Symbol, DFGVariableSummary}
87
factors::Dict{Symbol, DFGFactorSummary}

src/entities/DFGFactor.jl

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,16 @@ Base.@kwdef struct DFGFactorSummary <: AbstractDFGFactor
353353
timestamp::ZonedDateTime
354354
end
355355

356+
function DFGFactorSummary(
357+
label::Symbol,
358+
variableOrderSymbols::Vector{Symbol};
359+
timestamp::ZonedDateTime = now(localzone()),
360+
tags::Set{Symbol} = Set{Symbol}(),
361+
id::Union{UUID, Nothing} = nothing,
362+
)
363+
return DFGFactorSummary(id, label, tags, variableOrderSymbols, timestamp)
364+
end
365+
356366
##------------------------------------------------------------------------------
357367
## SkeletonDFGFactor lv0
358368
##------------------------------------------------------------------------------
@@ -392,7 +402,7 @@ function SkeletonDFGFactor(
392402
end
393403
function SkeletonDFGFactor(
394404
label::Symbol,
395-
variableOrderSymbols::Vector{Symbol} = Symbol[];
405+
variableOrderSymbols::Vector{Symbol};
396406
id::Union{UUID, Nothing} = nothing,
397407
tags = Set{Symbol}(),
398408
)

src/entities/DFGVariable.jl

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -317,20 +317,10 @@ The default DFGVariable constructor.
317317
function DFGVariable(
318318
label::Symbol,
319319
T::Type{<:InferenceVariable};
320-
estimateDict = nothing,
321-
timestamp = now(localzone()),
320+
timestamp::ZonedDateTime = now(localzone()),
322321
solvable::Union{Int, Base.RefValue{Int}} = Ref(1),
323322
kwargs...,
324323
)
325-
#TODO deprecated, remove in v0.21 should have already been deprecated
326-
if !isnothing(estimateDict)
327-
error("Keyword argument `estimateDict` is deprecated use `ppeDict`")
328-
end
329-
if !isa(timestamp, ZonedDateTime)
330-
@warn "timestamp<:DateTime is deprecated, timestamp must be a ZonedDateTime, using local zone."
331-
timestamp = ZonedDateTime(timestamp, localzone())
332-
end
333-
334324
solvable isa Int && (solvable = Ref(solvable))
335325

336326
N = getDimension(T)

src/services/AbstractDFG.jl

Lines changed: 0 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -454,71 +454,6 @@ function getVariable(dfg::AbstractDFG, label::Symbol, solveKey::Symbol)
454454
return var
455455
end
456456

457-
"""
458-
$(SIGNATURES)
459-
"""
460-
function addFactor!(
461-
dfg::AbstractDFG,
462-
variables::Vector{<:AbstractDFGVariable},
463-
factor::F,
464-
) where {F <: AbstractDFGFactor}
465-
Base.depwarn(
466-
"addFactor!(dfg, variables, factor) is deprecated, use addFactor!(dfg, factor)",
467-
:addFactor!,
468-
)
469-
variableLabels = map(v -> v.label, variables)
470-
471-
if factor isa DFGFactor
472-
f = factor
473-
newfactor = DFGFactor(
474-
f.label,
475-
f.timestamp,
476-
f.nstime,
477-
f.tags,
478-
f.solverData,
479-
f.solvable,
480-
Tuple(variableLabels),
481-
)
482-
return addFactor!(dfg, newfactor)
483-
else
484-
resize!(factor._variableOrderSymbols, length(variableLabels))
485-
factor._variableOrderSymbols .= variableLabels
486-
return addFactor!(dfg, factor)
487-
end
488-
end
489-
490-
"""
491-
$(SIGNATURES)
492-
"""
493-
function addFactor!(
494-
dfg::AbstractDFG,
495-
variableLabels::Vector{Symbol},
496-
factor::F,
497-
) where {F <: AbstractDFGFactor}
498-
Base.depwarn(
499-
"addFactor!(dfg, variables, factor) is deprecated, use addFactor!(dfg, factor)",
500-
:addFactor!,
501-
)
502-
503-
if factor isa DFGFactor
504-
f = factor
505-
newfactor = DFGFactor(
506-
f.label,
507-
f.timestamp,
508-
f.nstime,
509-
f.tags,
510-
f.solverData,
511-
f.solvable,
512-
Tuple(variableLabels),
513-
)
514-
return addFactor!(dfg, newfactor)
515-
else
516-
resize!(factor._variableOrderSymbols, length(variableLabels))
517-
factor._variableOrderSymbols .= variableLabels
518-
return addFactor!(dfg, factor)
519-
end
520-
end
521-
522457
"""
523458
$(SIGNATURES)
524459
Delete a referenced DFGVariable from the DFG.

src/services/CustomPrinting.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ function Base.show(io::IO, dfg::AbstractDFG)
215215
println(io, " Description: ", getDescription(dfg))
216216
println(io, " Nr variables: ", length(ls(dfg)))
217217
println(io, " Nr factors: ", length(lsf(dfg)))
218-
println(io, " Agent Metadata: ", keys(getAgentmetadata(dfg)))
218+
println(io, " Agent Metadata: ", keys(getAgentMetadata(dfg)))
219219
println(io, " Graph Metadata: ", keys(getGraphMetadata(dfg)))
220220
return
221221
end

test/FactorGraphsTests.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ end
6666
[:a, :b],
6767
SkeletonDFGFactor(:abf1, [:a, :b]),
6868
)
69-
@test @test_logs (:error, r"not found") !FactorGraphs.addFactor!(
69+
@test_throws KeyError FactorGraphs.addFactor!(
7070
fg,
7171
[:a, :c],
7272
SkeletonDFGFactor(:acf1, [:a, :c]),

test/GraphsDFGSummaryTypes.jl

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,6 @@ function DistributedFactorGraphs.DFGVariableSummary(label::Symbol)
1414
Dict{Symbol, BlobEntry}(),
1515
)
1616
end
17-
function DistributedFactorGraphs.DFGFactorSummary(label::Symbol)
18-
return DFGFactorSummary(
19-
nothing,
20-
label,
21-
Set{Symbol}(),
22-
Symbol[],
23-
DistributedFactorGraphs.now(localzone()),
24-
)
25-
end
2617

2718
function DistributedFactorGraphs.DFGVariableSummary(
2819
label::Symbol,
@@ -54,10 +45,9 @@ dfg = GraphsDFG{NoSolverParams, VARTYPE, FACTYPE}()
5445
v1 = VARTYPE(:a)
5546
v2 = VARTYPE(:b)
5647
v3 = VARTYPE(:c)
57-
f0 = FACTYPE(:af1)
58-
f1 = FACTYPE(:abf1)
59-
f2 = FACTYPE(:bcf1)
60-
append!(f2._variableOrderSymbols, [:b, :c])
48+
f0 = FACTYPE(:af1, [:a])
49+
f1 = FACTYPE(:abf1, [:a, :b])
50+
f2 = FACTYPE(:bcf1, [:b, :c])
6151

6252
union!(v1.tags, [:VARIABLE, :POSE])
6353
union!(v2.tags, [:VARIABLE, :LANDMARK])
@@ -150,7 +140,7 @@ end
150140
fg = GraphsDFG{NoSolverParams, VARTYPE, FACTYPE}()
151141
addVariable!(fg, VARTYPE(:a))
152142
addVariable!(fg, VARTYPE(:b))
153-
addFactor!(fg, [:a, :b], FACTYPE(:abf1))
143+
addFactor!(fg, FACTYPE(:abf1, [:a, :b]))
154144
addVariable!(fg, VARTYPE(:orphan))
155145

156146
AdjacencyMatricesTestBlock(fg)

0 commit comments

Comments
 (0)