Skip to content

Commit

Permalink
Handle Enum variables in set_defaults_and_check_section!()
Browse files Browse the repository at this point in the history
Use our `Enum`-handling method of `Base.get()` to handle `Enum` type
variables in `set_defaults_and_check_section!()`.
  • Loading branch information
johnomotani committed Aug 8, 2024
1 parent 30f9e58 commit 812540d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions moment_kinetics/src/input_structs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 812540d

Please sign in to comment.