From 3a2502f63e9895e674d00f3bade893032cfe28cc Mon Sep 17 00:00:00 2001 From: David Widmann Date: Fri, 27 Oct 2023 15:17:39 +0200 Subject: [PATCH] Apply suggestions from code review Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- ext/DynamicPPLMCMCChainsExt.jl | 6 +++++- src/sampler.jl | 6 ++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/ext/DynamicPPLMCMCChainsExt.jl b/ext/DynamicPPLMCMCChainsExt.jl index 5f62f4557..8c598a6a8 100644 --- a/ext/DynamicPPLMCMCChainsExt.jl +++ b/ext/DynamicPPLMCMCChainsExt.jl @@ -17,7 +17,11 @@ end # Load state from a `Chains`: By convention, it is stored in `:samplerstate` metadata function DynamicPPL.loadstate(chain::MCMCChains.Chains) if !haskey(chain.info, :samplerstate) - throw(ArgumentError("The chain object does not contain the final state of the sampler: Metadata `:samplerstate` missing.")) + throw( + ArgumentError( + "The chain object does not contain the final state of the sampler: Metadata `:samplerstate` missing.", + ), + ) end return chain.info[:samplerstate] end diff --git a/src/sampler.jl b/src/sampler.jl index 4b6ee7c78..7435413d7 100644 --- a/src/sampler.jl +++ b/src/sampler.jl @@ -87,10 +87,12 @@ function AbstractMCMC.sample( N::Integer; chain_type=default_chain_type(sampler), resume_from=nothing, - kwargs... + kwargs..., ) initial_state = loadstate(resume_from) - return AbstractMCMC.mcmcsample(rng, model, sampler, N; chain_type, initial_state, kwargs...) + return AbstractMCMC.mcmcsample( + rng, model, sampler, N; chain_type, initial_state, kwargs... + ) end # initial step: general interface for resuming and