Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
sunxd3 and github-actions[bot] authored Mar 12, 2024
1 parent c2410e7 commit 62dff76
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/JuliaBUGS.jl
Original file line number Diff line number Diff line change
Expand Up @@ -236,13 +236,17 @@ Compile a BUGS model into a log density problem.
"""
function compile(model_def::Expr, data, inits; is_transformed=true)
if !(data isa NamedTuple) && !(data isa Dict{Symbol,<:Any})
error("Data must be a NamedTuple or a Dict{Symbol,<:Any}. Received: $(typeof(data))")
error(
"Data must be a NamedTuple or a Dict{Symbol,<:Any}. Received: $(typeof(data))"
)
elseif data isa Dict{Symbol,<:Any}
data = NamedTuple{Tuple(keys(data))}(values(data))
end

if !(inits isa NamedTuple) && !(inits isa Dict{Symbol,<:Any})
error("Initializations must be a NamedTuple or a Dict{Symbol,<:Any}. Received: $(typeof(inits))")
error(
"Initializations must be a NamedTuple or a Dict{Symbol,<:Any}. Received: $(typeof(inits))",
)
elseif inits isa Dict{Symbol,<:Any}
inits = NamedTuple{Tuple(keys(inits))}(values(inits))
end
Expand Down

0 comments on commit 62dff76

Please sign in to comment.