From 812540d3e2f738362e0251f2dd670d01d12bc2f0 Mon Sep 17 00:00:00 2001 From: John Omotani Date: Thu, 8 Aug 2024 11:22:47 +0100 Subject: [PATCH] Handle `Enum` variables in `set_defaults_and_check_section!()` Use our `Enum`-handling method of `Base.get()` to handle `Enum` type variables in `set_defaults_and_check_section!()`. --- moment_kinetics/src/input_structs.jl | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/moment_kinetics/src/input_structs.jl b/moment_kinetics/src/input_structs.jl index 2fa125166..47aea55ce 100644 --- a/moment_kinetics/src/input_structs.jl +++ b/moment_kinetics/src/input_structs.jl @@ -704,11 +704,12 @@ function set_defaults_and_check_section!(options::AbstractDict, section_name; # Set default values if a key was not set explicitly explicit_keys = keys(section) - for (key_sym, value) ∈ kwargs + for (key_sym, default_value) ∈ kwargs key = String(key_sym) - if !(key ∈ explicit_keys) - section[key] = value - end + + # Use `Base.get()` here to take advantage of our `Enum`-handling method of + # `Base.get()` defined above. + section[key] = get(section, key, default_value) end return section