Skip to content

Commit

Permalink
Use nameof instead of custom function
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-thom committed Mar 9, 2024
1 parent fccae18 commit 908ce15
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/core/optimization_container_keys.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ function encode_symbol(
meta::String = CONTAINER_KEY_EMPTY_META,
) where {T <: Union{PSY.Component, PSY.System}, U}
meta_ = isempty(meta) ? meta : _DELIMITER * meta
T_ = replace(replace(IS.strip_module_name(T), "{" => _DELIMITER), "}" => "")
return Symbol("$(IS.strip_module_name(string(U)))$(_DELIMITER)$(T_)" * meta_)
T_ = replace(replace(string(nameof(T)), "{" => _DELIMITER), "}" => "")
return Symbol("$(nameof(U))$(_DELIMITER)$(T_)" * meta_)
end

function check_meta_chars(meta)
Expand Down
4 changes: 2 additions & 2 deletions src/operation/problem_results.jl
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ function ProblemResults(model::DecisionModel)
expression_values,
optimizer_stats,
get_metadata(get_optimization_container(model)),
IS.strip_module_name(typeof(model)),
string(nameof(typeof(model))),
mkpath(joinpath(get_output_dir(model), "results")),
)
end
Expand Down Expand Up @@ -131,7 +131,7 @@ function ProblemResults(model::EmulationModel)
expression,
optimizer_stats,
get_metadata(container),
IS.strip_module_name(typeof(model)),
string((typeof(model))),
mkpath(joinpath(get_output_dir(model), "results")),
)
end
Expand Down
4 changes: 2 additions & 2 deletions src/utils/printing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ function _show_method(io::IO, sim_models::SimulationModels, backend::Symbol; kwa
table = Matrix{Any}(undef, length(sim_models.decision_models), length(header))
for (ix, model) in enumerate(sim_models.decision_models)
table[ix, 1] = string(get_name(model))
table[ix, 2] = IS.strip_module_name(string(_get_model_type(model)))
table[ix, 2] = string(nameof(_get_model_type(model)))
table[ix, 3] = string(get_status(model))
table[ix, 4] = get_output_dir(model)
end
Expand All @@ -300,7 +300,7 @@ function _show_method(io::IO, sim_models::SimulationModels, backend::Symbol; kwa
table = Matrix{Any}(undef, 1, length(header))
table[1, 1] = string(get_name(sim_models.emulation_model))
table[1, 2] =
IS.strip_module_name(string(_get_model_type(sim_models.emulation_model)))
string(nameof(_get_model_type(sim_models.emulation_model)))
table[1, 3] = string(get_status(sim_models.emulation_model))
table[1, 4] = get_output_dir(sim_models.emulation_model)

Expand Down

0 comments on commit 908ce15

Please sign in to comment.