Skip to content

Commit 2df56db

Browse files
committed
fix formatting
1 parent 4c5d3a8 commit 2df56db

11 files changed

Lines changed: 60 additions & 67 deletions

File tree

src/Deprecated.jl

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ function getHash(entry::Blobentry)
1111
end
1212

1313
function getMetadata(node)
14-
error(
14+
return error(
1515
"getMetadata(node::$(typeof(node))) is deprecated; metadata is now stored in bloblets. Use getBloblets instead.",
1616
)
1717
# return JSON.parse(base64decode(f.metadata), Dict{Symbol, MetadataTypes})
@@ -20,8 +20,14 @@ end
2020
# getTimestamp
2121

2222
# setTimestamp is deprecated for now we can implement setTimestamp!(dfg, lbl, ts) later.
23-
setTimestamp(args...; kwargs...) = error("setTimestamp is obsolete, use addVariable!(..., timestamp=...) instead.")
24-
setTimestamp!(args...; kwargs...) = error("setTimestamp! is not implemented, use addVariable!(..., timestamp=...) instead.")
23+
function setTimestamp(args...; kwargs...)
24+
return error("setTimestamp is obsolete, use addVariable!(..., timestamp=...) instead.")
25+
end
26+
function setTimestamp!(args...; kwargs...)
27+
return error(
28+
"setTimestamp! is not implemented, use addVariable!(..., timestamp=...) instead.",
29+
)
30+
end
2531

2632
##------------------------------------------------------------------------------
2733
## solveInProgress
@@ -125,16 +131,15 @@ setAgentMetadata!(args...) = error("setAgentMetadata! is obsolete, use Bloblets
125131
getGraphMetadata(args...) = error("getGraphMetadata is obsolete, use Bloblets instead.")
126132
setGraphMetadata!(args...) = error("setGraphMetadata! is obsolete, use Bloblets instead.")
127133

128-
setDescription!(args...) = error("setDescription! was removed and may be implemented later.")
134+
function setDescription!(args...)
135+
return error("setDescription! was removed and may be implemented later.")
136+
end
129137

130138
# TODO find replacement.
131139
function _getDuplicatedEmptyDFG(
132140
dfg::GraphsDFG{P, V, F},
133141
) where {P <: AbstractDFGParams, V <: AbstractGraphVariable, F <: AbstractGraphFactor}
134-
Base.depwarn(
135-
"_getDuplicatedEmptyDFG is deprecated.",
136-
:_getDuplicatedEmptyDFG,
137-
)
142+
Base.depwarn("_getDuplicatedEmptyDFG is deprecated.", :_getDuplicatedEmptyDFG)
138143
newDfg = GraphsDFG{P, V, F}(;
139144
agentLabel = getAgentLabel(dfg),
140145
graphLabel = getGraphLabel(dfg),

src/DistributedFactorGraphs.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ const unstable_functions::Vector{Symbol} = [
426426
:setSolvedCount!,
427427
:setMarginalized!,
428428
# no set on these
429-
429+
430430
#deprecated in v0.29
431431
:setTimestamp,
432432
:setMetadata!, # no set, use add merge

src/GraphsDFG/entities/GraphsDFG.jl

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -74,17 +74,12 @@ function GraphsDFG{T, V, F}(
7474
end
7575

7676
# Validate the graphLabel and agentLabel
77-
!DFG.isValidLabel(graphLabel) && throw(ArgumentError("'$graphLabel' is not a valid label"))
78-
!DFG.isValidLabel(agentLabel) && throw(ArgumentError("'$agentLabel' is not a valid label"))
77+
!DFG.isValidLabel(graphLabel) &&
78+
throw(ArgumentError("'$graphLabel' is not a valid label"))
79+
!DFG.isValidLabel(agentLabel) &&
80+
throw(ArgumentError("'$agentLabel' is not a valid label"))
7981

80-
return GraphsDFG{T, V, F}(
81-
g,
82-
addHistory,
83-
solverParams,
84-
blobStores,
85-
graph,
86-
agent,
87-
)
82+
return GraphsDFG{T, V, F}(g, addHistory, solverParams, blobStores, graph, agent)
8883
end
8984

9085
# GraphsDFG{T}(; kwargs...) where T <: AbstractDFGParams = GraphsDFG{T,VariableCompute,FactorDFG}(;kwargs...)

src/entities/DFGFactor.jl

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -71,33 +71,33 @@ StructUtils.@kwarg struct FactorDFG{T <: AbstractObservation, N} <: AbstractGrap
7171
tags::Set{Symbol} = Set{Symbol}([:FACTOR])
7272
"""Ordered list of the neighbor variables.
7373
Accessors: [`getVariableOrder`](@ref)"""
74-
variableorder::NTuple{N, Symbol} &(choosetype=x->NTuple{length(x), Symbol},) # NOTE v0.29 renamed from _variableOrderSymbols
74+
variableorder::NTuple{N, Symbol} & (choosetype = x->NTuple{length(x), Symbol},) # NOTE v0.29 renamed from _variableOrderSymbols
7575
"""Variable timestamp.
7676
Accessors: [`getTimestamp`](@ref)"""
77-
timestamp::NanoDate = ndnow(UTC) &(lower = timestamp,) # NOTE v0.29 changed from ZonedDateTime
77+
timestamp::NanoDate = ndnow(UTC) & (lower = timestamp,) # NOTE v0.29 changed from ZonedDateTime
7878
# TODO
7979
# """(Optional) Steady (monotonic) time in nanoseconds `Nanosecond` (`Int64``)"""
8080
# nstime::Nanosecond #NOTE v0.29 REMOVED as not used, add when needed, or now as steadytime.
8181
"""Solvable flag for the factor.
8282
Accessors: [`getSolvable`](@ref), [`setSolvable!`](@ref)"""
83-
solvable::Base.RefValue{Int} = Ref(1) &(lower = getindex, lift = Ref)
83+
solvable::Base.RefValue{Int} = Ref(1) & (lower = getindex, lift = Ref)
8484
"""Dictionary of small data associated with this variable.
8585
Accessors: [`getBloblet`](@ref), [`addBloblet!`](@ref)"""
8686
bloblets::Bloblets = Bloblets() #NOTE v0.29 changed from smallData::Dict{Symbol, MetadataTypes} = Dict{Symbol, MetadataTypes}()
8787
"""Observation function or measurement for this factor.
8888
Accessors: [`getObservation`](@ref)(@ref)"""
89-
observation::T &(lower = pack_lower, choosetype=DFG.resolvePackedType)#TODO finalise serializd type
89+
observation::T & (lower = pack_lower, choosetype = DFG.resolvePackedType)#TODO finalise serializd type
9090
"""Describes the current state of the factor. Persisted in serialization.
9191
Accessors: [`getFactorState`](@ref)"""
9292
state::FactorState = FactorState()
9393
"""Temporary, non-persistent memory used internally by the solver for intermediate numerical computations and buffers.
9494
`solvercache` is lazily allocated and only used during factor operations; it is not serialized or retained after solving.
9595
Accessors: [`getCache`](@ref), [`setCache!`](@ref)"""
96-
solvercache::Base.RefValue{<:FactorCache} = Ref{FactorCache}() &(ignore = true, )#TODO easy of use vs. performance as container is abstract in any case.
96+
solvercache::Base.RefValue{<:FactorCache} = Ref{FactorCache}() & (ignore = true,)#TODO easy of use vs. performance as container is abstract in any case.
9797
"""Blobentries associated with this factor."""
9898
blobentries::Blobentries = Blobentries() #NOTE v0.29 added
9999
"""Internal: used for automatic type metadata generation."""
100-
_autotype::Nothing = nothing &(name = :type, lower = _ -> TypeMetadata(FactorDFG), )
100+
_autotype::Nothing = nothing & (name = :type, lower = _ -> TypeMetadata(FactorDFG))
101101
end
102102

103103
version(::Type{<:FactorDFG}) = v"0.29.0"
@@ -131,7 +131,10 @@ function FactorDFG(
131131
end
132132

133133
if timestamp isa ZonedDateTime
134-
Base.depwarn("`FactorDFG` timestamp as `ZonedDateTime` is deprecated, use `NanoDate` instead", :FactorDFG)
134+
Base.depwarn(
135+
"`FactorDFG` timestamp as `ZonedDateTime` is deprecated, use `NanoDate` instead",
136+
:FactorDFG,
137+
)
135138
timestamp = NanoDate(timestamp.utc_datetime)
136139
end
137140

@@ -174,7 +177,10 @@ function FactorDFG(
174177
Base.depwarn("`FactorDFG` nstime is deprecated", :FactorDFG)
175178
end
176179
if !isnothing(smallData)
177-
Base.depwarn("`FactorDFG` smallData is deprecated, use bloblets instead", :FactorDFG)
180+
Base.depwarn(
181+
"`FactorDFG` smallData is deprecated, use bloblets instead",
182+
:FactorDFG,
183+
)
178184
end
179185

180186
if isnothing(cache)
@@ -185,7 +191,10 @@ function FactorDFG(
185191

186192
# deprecated in v0.29
187193
if timestamp isa ZonedDateTime
188-
Base.depwarn("`FactorDFG` timestamp as `ZonedDateTime` is deprecated, use `NanoDate(timestamp.utc_datetime)` instead", :FactorDFG)
194+
Base.depwarn(
195+
"`FactorDFG` timestamp as `ZonedDateTime` is deprecated, use `NanoDate(timestamp.utc_datetime)` instead",
196+
:FactorDFG,
197+
)
189198
nd_timestamp = NanoDate(timestamp.utc_datetime)
190199
else
191200
nd_timestamp = timestamp
@@ -282,18 +291,9 @@ end
282291
##==============================================================================
283292

284293
function FactorSummary(f::FactorDFG)
285-
return FactorSummary(
286-
f.label,
287-
copy(f.tags),
288-
f.variableorder,
289-
f.timestamp,
290-
)
294+
return FactorSummary(f.label, copy(f.tags), f.variableorder, f.timestamp)
291295
end
292296

293297
function FactorSkeleton(f::AbstractGraphFactor)
294-
return FactorSkeleton(
295-
f.label,
296-
copy(f.tags),
297-
f.variableorder,
298-
)
298+
return FactorSkeleton(f.label, copy(f.tags), f.variableorder)
299299
end

src/serialization/PackedSerialization.jl

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
function pack end
22
function unpack end
33

4-
version(::Type{T}) where T = pkgversion(parentmodule(T))
4+
version(::Type{T}) where {T} = pkgversion(parentmodule(T))
55
# version(node) = node.version
66

77
# Type for storing packed type information
@@ -11,18 +11,18 @@ struct TypeMetadata
1111
version::Union{Nothing, VersionNumber}
1212
end
1313

14-
function TypeMetadata(::Type{T}) where T
15-
TypeMetadata(fullname(parentmodule(T))[1], nameof(T), version(T))
14+
function TypeMetadata(::Type{T}) where {T}
15+
return TypeMetadata(fullname(parentmodule(T))[1], nameof(T), version(T))
1616
end
1717

1818
StructUtils.@nonstruct struct Packed{T}
1919
type::TypeMetadata
2020
packed::T
2121
end
2222

23-
function Packed(x)
23+
function Packed(x)
2424
packedx = pack(x)
25-
Packed(TypeMetadata(typeof(packedx)), packedx)
25+
return Packed(TypeMetadata(typeof(packedx)), packedx)
2626
end
2727

2828
function StructUtils.lower(x::Packed)
@@ -31,12 +31,12 @@ function StructUtils.lower(x::Packed)
3131
return d
3232
end
3333

34-
function StructUtils.lift(::Type{<:Packed{T}}, x) where T
34+
function StructUtils.lift(::Type{<:Packed{T}}, x) where {T}
3535
r = unpack(StructUtils.make(T, x))
3636
return r
3737
end
3838

39-
function pack_lower(x)
39+
function pack_lower(x)
4040
px = Packed(x)
4141
d = StructUtils.make(OrderedDict{Symbol, Any}, px.packed)
4242
push!(d, :type => px.type)
@@ -69,10 +69,9 @@ end
6969

7070
@choosetype Packed resolvePackedType
7171

72-
7372
# Stash optional TypeMetadata expansion function.
7473
# function expandTypeMetadata(;kwargs...)
7574
# md = StructUtils.make(OrderedDict{Symbol, Any}, TypeMetadata(FactorDFG))
7675
# push!(md, kwargs...)
7776
# return md
78-
# end
77+
# end

src/services/AbstractDFG.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,6 @@ function listNeighbors end
433433
## copy and duplication
434434
##------------------------------------------------------------------------------
435435

436-
437436
##------------------------------------------------------------------------------
438437
## CRUD Aliases
439438
##------------------------------------------------------------------------------

src/services/CompareUtils.jl

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,14 @@ function compareVariable(
241241
)
242242
#
243243
skiplist = union(
244-
[:attributes; :solverDataDict; :createdTimestamp; :lastUpdatedTimestamp; :timezone; :zone],
244+
[
245+
:attributes;
246+
:solverDataDict;
247+
:createdTimestamp;
248+
:lastUpdatedTimestamp;
249+
:timezone;
250+
:zone
251+
],
245252
skip,
246253
)
247254
TP = compareAll(A, B; skip = skiplist, show = show)
@@ -281,14 +288,7 @@ function compareFactor(
281288
)
282289
#
283290
skip_ = union(
284-
[
285-
:attributes,
286-
:solverData,
287-
:observation,
288-
:solvercache,
289-
:variableorder,
290-
:_gradients,
291-
],
291+
[:attributes, :solverData, :observation, :solvercache, :variableorder, :_gradients],
292292
skip,
293293
)
294294
TP = compareAll(A, B; skip = skip_, show = show)

src/services/DFGFactor.jl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,10 @@ macro defObservationType(structname, factortype, manifold)
9797
") is not an `AbstractObservation`"
9898

9999
Base.@__doc__ DFG.@tags struct $structname{T} <: $factortype
100-
Z::T &(lower = DFG.Packed, choosetype=DFG.resolvePackedType)
100+
Z::T & (lower = DFG.Packed, choosetype = DFG.resolvePackedType)
101101
end
102102

103103
DFG.getManifold(::Type{<:$structname}) = $manifold
104-
105104
end,
106105
)
107106
end
@@ -139,7 +138,6 @@ getManifold(f::AbstractGraphFactor) = getManifold(getObservation(f))
139138

140139
## COMMON
141140

142-
143141
##------------------------------------------------------------------------------
144142
## solvable
145143
##------------------------------------------------------------------------------

src/services/DFGVariable.jl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,8 +391,6 @@ end
391391
## COMMON
392392
# getTimestamp
393393

394-
395-
396394
##------------------------------------------------------------------------------
397395
## solvable
398396
##------------------------------------------------------------------------------

test/interfaceTests.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ end
6565
nothing
6666

6767
@test String(take!(iobuf)) ==
68-
"VariableCompute{TestVariableType1, Vector{Float64}, 1}\nid:\nnothing\nlabel:\n:a\ntags:\nSet([:VARIABLE, :POSE])\nsmallData:\nDict{Symbol, Union{Bool, Float64, Int64, Vector{Bool}, Vector{Float64}, Vector{Int64}, Vector{String}, String}}()\ndataDict:\nDict{Symbol, Blobentry}()\nsolvable:\nRefValue{Int64}(0)\n"
69-
# "VariableCompute{TestVariableType1, Vector{Float64}, 1}\nid:\nnothing\nlabel:\n:a\ntags:\nSet([:VARIABLE, :POSE])\nsmallData:\nDict{Symbol, Union{Bool, Float64, Int64, Vector{Bool}, Vector{Float64}, Vector{Int64}, Vector{String}, String}}(:small=>\"data\")\ndataDict:\nDict{Symbol, Blobentry}()\nsolvable:\n0\n"
68+
"VariableCompute{TestVariableType1, Vector{Float64}, 1}\nid:\nnothing\nlabel:\n:a\ntags:\nSet([:VARIABLE, :POSE])\nsmallData:\nDict{Symbol, Union{Bool, Float64, Int64, Vector{Bool}, Vector{Float64}, Vector{Int64}, Vector{String}, String}}()\ndataDict:\nDict{Symbol, Blobentry}()\nsolvable:\nRefValue{Int64}(0)\n"
69+
# "VariableCompute{TestVariableType1, Vector{Float64}, 1}\nid:\nnothing\nlabel:\n:a\ntags:\nSet([:VARIABLE, :POSE])\nsmallData:\nDict{Symbol, Union{Bool, Float64, Int64, Vector{Bool}, Vector{Float64}, Vector{Int64}, Vector{String}, String}}(:small=>\"data\")\ndataDict:\nDict{Symbol, Blobentry}()\nsolvable:\n0\n"
7070

7171
@test printVariable(iobuf, var1; short = true) === nothing
7272
varstr = String(take!(iobuf))

0 commit comments

Comments
 (0)