diff --git a/docs/src/ref/ref_structures_definitions.md b/docs/src/ref/ref_structures_definitions.md index c6f2d9d3c..0c1bab5c5 100644 --- a/docs/src/ref/ref_structures_definitions.md +++ b/docs/src/ref/ref_structures_definitions.md @@ -34,7 +34,6 @@ Composite components are defined using the `@defcomposite` macro which generates # CompositeComponentDef <: ComponentDef internal_param_conns::Vector{InternalParameterConnection} backups::Vector{Symbol} -sorted_comps::Union{Nothing, Vector{Symbol}} ``` The namespace of a composite component can hold `CompositeParameterDef`s and`CompositeVariableDef`s, as well as `AbstractComponentDef`s (which can be other leaf or composite component definitions). diff --git a/src/Mimi.jl b/src/Mimi.jl index a041b8338..e934e1d3e 100644 --- a/src/Mimi.jl +++ b/src/Mimi.jl @@ -73,7 +73,6 @@ include("mcs/mcs.jl") # need mcs types for explorer and utils include("explorer/explore.jl") include("utils/getdataframe.jl") include("utils/graph.jl") -include("utils/lint_helper.jl") include("utils/misc.jl") # Load built-in components diff --git a/src/core/defs.jl b/src/core/defs.jl index 3476c9ee0..1fdc9926e 100644 --- a/src/core/defs.jl +++ b/src/core/defs.jl @@ -27,14 +27,6 @@ compname(obj::AbstractComponentDef) = compname(obj.comp_id) compnames() = map(compname, compdefs()) -""" - is_detached(obj::AbstractComponentDef) - -Return true if `obj` is not a ModelDef and it has no parent. -""" -is_detached(obj::AbstractComponentDef) = (obj.parent === nothing) -is_detached(obj::ModelDef) = false # by definition - dirty(md::ModelDef) = md.dirty function dirty!(obj::AbstractComponentDef) @@ -792,16 +784,6 @@ function _insert_comp!(obj::AbstractCompositeComponentDef, comp_def::AbstractCom nothing end -""" -Return True if time Dimension `outer` contains `inner`. -""" -function time_contains(outer::Dimension, inner::Dimension) - outer_idx = keys(outer) - inner_idx = keys(inner) - - return outer_idx[1] <= inner_idx[1] && outer_idx[end] >= inner_idx[end] -end - """ propagate_time!(obj::AbstractComponentDef, t::Dimension) diff --git a/src/core/types/defs.jl b/src/core/types/defs.jl index edc00eeb5..efb029e2b 100644 --- a/src/core/types/defs.jl +++ b/src/core/types/defs.jl @@ -159,9 +159,6 @@ global const NamespaceElement = Union{LeafNamespaceElement, CompositeNa # Names of external params that the ConnectorComps will use as their :input2 parameters. backups::Vector{Symbol} - - sorted_comps::Union{Nothing, Vector{Symbol}} - function CompositeComponentDef(comp_id::Union{Nothing, ComponentId}=nothing) self = new() CompositeComponentDef(self, comp_id) @@ -174,7 +171,6 @@ global const NamespaceElement = Union{LeafNamespaceElement, CompositeNa self.comp_path = ComponentPath(self.name) self.internal_param_conns = Vector{InternalParameterConnection}() self.backups = Vector{Symbol}() - self.sorted_comps = nothing end end diff --git a/src/utils/graph.jl b/src/utils/graph.jl index 90b3904d1..440b8c2f0 100644 --- a/src/utils/graph.jl +++ b/src/utils/graph.jl @@ -2,38 +2,6 @@ # Graph Functionality # -function _show_conns(io, m, comp_name, which::Symbol) - datumtype = which == :incoming ? "parameters" : "variables" - println(io, " $which $datumtype:") - - conns = get_connections(m, comp_name, which) - - if length(conns) == 0 - println(io, " none") - else - for conn in conns - if which == :incoming - println(io, " - $(conn.src_comp_path).$(conn.dst_par_name)") - else - println(io, " - $(conn.dst_comp_path).$(conn.src_var_name)") - end - end - end -end - -show_conns(m::Model) = show_conns(stdout, m) - -function show_conns(io::IO, m::Model) - println(io, "Model component connections:") - - for (i, comp_name) in enumerate(compkeys(m.md)) - comp_def = compdef(m.md, comp_name) - println(io, "$i. $(comp_def.comp_id) as :$(nameof(comp_def))") - _show_conns(io, m, comp_name, :incoming) - _show_conns(io, m, comp_name, :outgoing) - end -end - function _filter_connections(conns::Vector{InternalParameterConnection}, comp_path::ComponentPath, which::Symbol) if which == :all f = obj -> (obj.src_comp_path == comp_path || obj.dst_comp_path == comp_path) diff --git a/src/utils/lint_helper.jl b/src/utils/lint_helper.jl deleted file mode 100644 index 67a14f62d..000000000 --- a/src/utils/lint_helper.jl +++ /dev/null @@ -1,9 +0,0 @@ -function lint_helper(ex::Expr, ctx) - if ex.head == :macrocall - if ex.args[1] == Symbol("@defcomp") - push!(ctx.callstack[end].types, ex.args[2]) - return true - end - end - return false -end diff --git a/test/test_show.jl b/test/test_show.jl index 83e526bc4..33fd09769 100644 --- a/test/test_show.jl +++ b/test/test_show.jl @@ -90,7 +90,6 @@ Model ... 6: 0.0 1: time - sorted_comps: nothing number_type: Float64 mi: nothing""" # ignore (most) whitespace diff --git a/test/test_tools.jl b/test/test_tools.jl index c61ce04da..b6df559cd 100644 --- a/test/test_tools.jl +++ b/test/test_tools.jl @@ -2,9 +2,10 @@ module TestTools using Test using Mimi +using Logging import Mimi: - getproperty, pretty_string + getproperty, pretty_string, set_log_level, log_debug, log_info #utils: pretty_string @test pretty_string("camelCaseBasic") == pretty_string(:camelCaseBasic) == "Camel Case Basic" @@ -18,4 +19,10 @@ final = 10 ts = 10 @test Mimi.interpolate(collect(0:stepsize:final), ts) == collect(0:stepsize/ts:final) +# utils: logging - toggle back and forth +log_debug() +@test current_logger().min_level == Logging.Debug +log_info() +@test current_logger().min_level == Logging.Info + end #module