Skip to content

Commit b55d09f

Browse files
committed
change keyword arg
1 parent 418f52a commit b55d09f

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

src/core/defs.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,13 @@ find_first_period(comp_def::AbstractComponentDef) = @or(first_period(comp_def),
5858
find_last_period(comp_def::AbstractComponentDef) = @or(last_period(comp_def), last_period(get_root(comp_def)))
5959

6060
"""
61-
delete!(md::ModelDef, comp_name::Symbol; delete_unbound_comp_params::Bool=false)
61+
delete!(md::ModelDef, comp_name::Symbol; deep::Bool=false)
6262
6363
Delete a `component` by name from `md`.
64-
If `delete_unbound_comp_params=true` then any external model parameters connected only to
64+
If `deep=true` then any external model parameters connected only to
6565
this component will also be deleted.
6666
"""
67-
function Base.delete!(md::ModelDef, comp_name::Symbol; delete_unbound_comp_params::Bool=false)
67+
function Base.delete!(md::ModelDef, comp_name::Symbol; deep::Bool=false)
6868
if ! has_comp(md, comp_name)
6969
error("Cannot delete '$comp_name': component does not exist.")
7070
end
@@ -81,7 +81,7 @@ function Base.delete!(md::ModelDef, comp_name::Symbol; delete_unbound_comp_param
8181

8282
# Remove external parameter connections
8383

84-
if delete_unbound_comp_params # Find and delete external_params that were connected only to the deleted component if specified
84+
if deep # Find and delete external_params that were connected only to the deleted component if specified
8585
# Get all external parameters this component is connected to
8686
comp_ext_params = map(x -> x.external_param, filter(x -> x.comp_path == comp_path, md.external_param_conns))
8787

src/core/model.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -369,13 +369,13 @@ Add a scalar type parameter `name` with value `value` to the model `m`.
369369
@delegate set_external_scalar_param!(m::Model, name::Symbol, value::Any) => md
370370

371371
"""
372-
delete!(m::Model, component::Symbol; delete_unbound_comp_params::Bool=false)
372+
delete!(m::Model, component::Symbol; deep::Bool=false)
373373
374374
Delete a `component` by name from a model `m`'s ModelDef, and nullify the ModelInstance.
375-
If `delete_unbound_comp_params=true` then any external model parameters connected only to
375+
If `deep=true` then any external model parameters connected only to
376376
this component will also be deleted.
377377
"""
378-
@delegate Base.delete!(m::Model, comp_name::Symbol; delete_unbound_comp_params::Bool=false) => md
378+
@delegate Base.delete!(m::Model, comp_name::Symbol; deep::Bool=false) => md
379379

380380
"""
381381
delete_param!(m::Model, external_param_name::Symbol)

test/test_delete.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module TestDelete
22

3-
# Test the behavior of the `delete!` function with and without the `delete_unbound_comp_params` kwarg.
3+
# Test the behavior of the `delete!` function with and without the `deep` kwarg.
44

55
using Mimi
66
using Test
@@ -36,7 +36,7 @@ run(m1) # run before and after to test that `delete!` properly "dirties" the mod
3636

3737
# Test component deletion that removes unbound component parameters
3838
m2 = _get_model()
39-
delete!(m2, :A1, delete_unbound_comp_params = true)
39+
delete!(m2, :A1, deep = true)
4040
@test length(Mimi.components(m2.md)) == 1
4141
@test length(m2.md.external_params) == 2 # :p2_A1 has been removed
4242
@test !(:p2_A1 in keys(m2.md.external_params))

0 commit comments

Comments
 (0)