Skip to content

Commit e6ebcb9

Browse files
committed
format
1 parent 75f4ec6 commit e6ebcb9

File tree

3 files changed

+21
-20
lines changed

3 files changed

+21
-20
lines changed

src/systems/abstractsystem.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -930,7 +930,7 @@ function complete(sys::AbstractSystem; split = true, flatten = true)
930930
# don't update unknowns to not disturb `structural_simplify` order
931931
# `GlobalScope`d unknowns will be picked up and added there
932932
@set! sys.ps = unique!(vcat(get_ps(sys), collect(newparams)))
933-
933+
934934
if flatten
935935
eqs = equations(sys)
936936
if eqs isa AbstractArray && eltype(eqs) <: Equation

src/systems/jumps/jumpsystem.jl

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -174,14 +174,15 @@ function JumpSystem(eqs, iv, unknowns, ps;
174174
"`default_u0` and `default_p` are deprecated. Use `defaults` instead.",
175175
:JumpSystem, force = true)
176176
end
177-
defaults = Dict{Any,Any}(todict(defaults))
177+
defaults = Dict{Any, Any}(todict(defaults))
178178
var_to_name = Dict()
179179
process_variables!(var_to_name, defaults, us′)
180180
process_variables!(var_to_name, defaults, ps′)
181181
process_variables!(var_to_name, defaults, [eq.lhs for eq in parameter_dependencies])
182182
process_variables!(var_to_name, defaults, [eq.rhs for eq in parameter_dependencies])
183-
defaults = Dict{Any, Any}(value(k) => value(v) for (k, v) in pairs(defaults)
184-
if value(v) !== nothing)
183+
#! format: off
184+
defaults = Dict{Any, Any}(value(k) => value(v) for (k, v) in pairs(defaults) if value(v) !== nothing)
185+
#! format: on
185186
isempty(observed) || collect_var_to_name!(var_to_name, (eq.lhs for eq in observed))
186187

187188
sysnames = nameof.(systems)
@@ -218,8 +219,8 @@ end
218219

219220
##### MTK dispatches for JumpSystems #####
220221
eqtype_supports_collect_vars(j::MassActionJump) = true
221-
function collect_vars!(unknowns, parameters, j::MassActionJump, iv; depth = 0,
222-
op = Differential)
222+
function collect_vars!(unknowns, parameters, j::MassActionJump, iv; depth = 0,
223+
op = Differential)
223224
collect_vars!(unknowns, parameters, j.scaled_rates, iv; depth, op)
224225
for field in (j.reactant_stoch, j.net_stoch)
225226
for el in field
@@ -229,8 +230,8 @@ function collect_vars!(unknowns, parameters, j::MassActionJump, iv; depth = 0,
229230
return nothing
230231
end
231232

232-
eqtype_supports_collect_vars(j::Union{ConstantRateJump,VariableRateJump}) = true
233-
function collect_vars!(unknowns, parameters, j::Union{ConstantRateJump,VariableRateJump},
233+
eqtype_supports_collect_vars(j::Union{ConstantRateJump, VariableRateJump}) = true
234+
function collect_vars!(unknowns, parameters, j::Union{ConstantRateJump, VariableRateJump},
234235
iv; depth = 0, op = Differential)
235236
collect_vars!(unknowns, parameters, j.rate, iv; depth, op)
236237
for eq in j.affect!
@@ -278,7 +279,7 @@ function assemble_vrj(
278279

279280
outputvars = (value(affect.lhs) for affect in vrj.affect!)
280281
outputidxs = [unknowntoid[var] for var in outputvars]
281-
affect = eval_or_rgf(generate_affect_function(js, vrj.affect!, outputidxs);
282+
affect = eval_or_rgf(generate_affect_function(js, vrj.affect!, outputidxs);
282283
eval_expression, eval_module)
283284
VariableRateJump(rate, affect)
284285
end
@@ -306,7 +307,7 @@ function assemble_crj(
306307

307308
outputvars = (value(affect.lhs) for affect in crj.affect!)
308309
outputidxs = [unknowntoid[var] for var in outputvars]
309-
affect = eval_or_rgf(generate_affect_function(js, crj.affect!, outputidxs);
310+
affect = eval_or_rgf(generate_affect_function(js, crj.affect!, outputidxs);
310311
eval_expression, eval_module)
311312
ConstantRateJump(rate, affect)
312313
end

test/jumpsystem.jl

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -341,15 +341,14 @@ let
341341
@test all(abs.(cmean .- cmean2) .<= 0.05 .* cmean)
342342
end
343343

344-
345344
# collect_vars! tests for jumps
346-
let
345+
let
347346
@variables x1(t) x2(t) x3(t) x4(t) x5(t)
348347
@parameters p1 p2 p3 p4 p5
349348
j1 = ConstantRateJump(p1, [x1 ~ x1 + 1])
350349
j2 = MassActionJump(p2, [x2 => 1], [x3 => -1])
351350
j3 = VariableRateJump(p3, [x3 ~ x3 + 1, x4 ~ x4 + 1])
352-
j4 = MassActionJump(p4*p5, [x1 => 1, x5 => 1], [x1 => -1, x5 => -1, x2 => 1])
351+
j4 = MassActionJump(p4 * p5, [x1 => 1, x5 => 1], [x1 => -1, x5 => -1, x2 => 1])
353352
us = Set()
354353
ps = Set()
355354
iv = t
@@ -389,35 +388,36 @@ let
389388
p3 = ParentScope(ParentScope(p3))
390389
p4 = DelayParentScope(p4, 2)
391390
p5 = GlobalScope(p5)
392-
391+
393392
j1 = ConstantRateJump(p1, [x1 ~ x1 + 1])
394393
j2 = MassActionJump(p2, [x2 => 1], [x3 => -1])
395394
j3 = VariableRateJump(p3, [x3 ~ x3 + 1, x4 ~ x4 + 1])
396-
j4 = MassActionJump(p4*p5, [x1 => 1, x5 => 1], [x1 => -1, x5 => -1, x2 => 1])
395+
j4 = MassActionJump(p4 * p5, [x1 => 1, x5 => 1], [x1 => -1, x5 => -1, x2 => 1])
397396
@named js = JumpSystem([j1, j2, j3, j4], t, [x1, x2, x3, x4, x5], [p1, p2, p3, p4, p5])
398397

399-
us = Set(); ps = Set()
398+
us = Set()
399+
ps = Set()
400400
iv = t
401401
MT.collect_scoped_vars!(us, ps, js, iv)
402402
@test issetequal(us, [x2])
403403
@test issetequal(ps, [p2])
404404

405-
empty!.((us,ps))
405+
empty!.((us, ps))
406406
MT.collect_scoped_vars!(us, ps, js, iv; depth = 0)
407407
@test issetequal(us, [x1])
408408
@test issetequal(ps, [p1])
409409

410-
empty!.((us,ps))
410+
empty!.((us, ps))
411411
MT.collect_scoped_vars!(us, ps, js, iv; depth = 1)
412412
@test issetequal(us, [x2])
413413
@test issetequal(ps, [p2])
414414

415-
empty!.((us,ps))
415+
empty!.((us, ps))
416416
MT.collect_scoped_vars!(us, ps, js, iv; depth = 2)
417417
@test issetequal(us, [x3, x4])
418418
@test issetequal(ps, [p3, p4])
419419

420-
empty!.((us,ps))
420+
empty!.((us, ps))
421421
MT.collect_scoped_vars!(us, ps, js, iv; depth = -1)
422422
@test issetequal(us, [x5])
423423
@test issetequal(ps, [p5])

0 commit comments

Comments
 (0)