Skip to content

Commit ae43625

Browse files
committed
Merge branch 'feat/inherit_desc_names' of https://github.com/EnergyModelsX/EnergyModelsGUI.jl into feat/inherit_desc_names
2 parents 4297473 + 9767bc3 commit ae43625

1 file changed

Lines changed: 9 additions & 41 deletions

File tree

src/utils_gen/utils.jl

Lines changed: 9 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -321,25 +321,10 @@ function get_types(modul::Module)
321321
return types
322322
end
323323

324-
function get_types(moduls::Vector{Module})
325-
types=[]
326-
for modul moduls
327-
append!(types, get_types(modul))
328-
end
329-
return types
330-
end
331-
332-
function get_types(pkg::Union{String,Symbol})
333-
return get_types(getfield(Main, Symbol(pkg)))
334-
end
335-
336-
function get_types(pkgs::Union{Vector{<:Union{String,Symbol}},Set{<:Union{String,Symbol}}})
337-
types = []
338-
for pkg pkgs
339-
append!(types, get_types(pkg))
340-
end
341-
return types
342-
end
324+
get_types(modules::Vector{Module}) = [get_types(modul) for modul modules]
325+
get_types(pkg::Union{String,Symbol}) = get_types(getfield(Main, Symbol(pkg)))
326+
get_types(pkgs::Union{Vector{<:Union{String,Symbol}},Set{<:Union{String,Symbol}}}) =
327+
get_types.(pkgs)
343328

344329
"""
345330
get_supertypes(input) -> Dict{Symbol, Vector{Type}}
@@ -385,27 +370,11 @@ function get_supertypes(modul::Module)
385370
return types
386371
end
387372

388-
function get_supertypes(moduls::Vector{Module})
389-
types=Dict()
390-
for modul moduls
391-
merge!(types, get_supertypes(modul))
392-
end
393-
return types
394-
end
395-
396-
function get_supertypes(pkg::Union{String,Symbol})
397-
return get_supertypes(getfield(Main, Symbol(pkg)))
398-
end
399-
400-
function get_supertypes(
401-
pkgs::Union{Vector{<:Union{String,Symbol}},Set{<:Union{String,Symbol}}},
402-
)
403-
types = Dict()
404-
for pkg pkgs
405-
merge!(types, get_supertypes(pkg))
406-
end
407-
return types
408-
end
373+
get_supertypes(moduls::Vector{Module}) =
374+
merge!(Dict(), (get_supertypes(m) for m moduls)...)
375+
get_supertypes(pkg::Union{String,Symbol}) = get_supertypes(getfield(Main, Symbol(pkg)))
376+
get_supertypes(pkgs::Union{Vector{<:Union{String,Symbol}},Set{<:Union{String,Symbol}}}) =
377+
merge!(Dict(), (get_supertypes(pkg) for pkg pkgs)...)
409378

410379
"""
411380
has_fields(type::Type) -> Bool
@@ -460,7 +429,6 @@ function update_tree!(current_lvl, tmp_type::Type)
460429
if !haskey(current_lvl, tmp_type)
461430
current_lvl[tmp_type] = Dict{Type,Union{Dict,Nothing}}()
462431
end
463-
return
464432
end
465433

466434
"""

0 commit comments

Comments
 (0)