Skip to content

Commit

Permalink
Reformat
Browse files Browse the repository at this point in the history
  • Loading branch information
thevolatilebit committed Feb 26, 2024
1 parent 1a7a677 commit e97c53f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
5 changes: 3 additions & 2 deletions src/queries.jl
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,9 @@ Accepts both anonymous queries (`_.name`) and named queries (`name=_.name`). By
"""
macro transform(exs...)
n_noname::Int = 0
queries = map(ex -> Meta.isexpr(ex, :(=)) ? (ex.args[1], ex.args[2]) :
(n_noname += 1; ("query_$n_noname", ex)),
queries = map(
ex -> Meta.isexpr(ex, :(=)) ? (ex.args[1], ex.args[2]) :
(n_noname += 1; ("query_$n_noname", ex)),
exs)
names, queries = map(x -> x[1], queries), map(x -> x[2], queries)
quote
Expand Down
6 changes: 4 additions & 2 deletions src/wires.jl
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ function add_wire!(a::AbstractAlgebraicAgent;
from::T,
to::T,
from_var_name = nothing,
to_var_name = nothing) where {T <: Union{AbstractAlgebraicAgent, AbstractString, UUID}}
to_var_name = nothing) where {T <:
Union{AbstractAlgebraicAgent, AbstractString, UUID}}
from, to = to_agent(a, from), to_agent(a, to)
from_var_name = something(from_var_name, to_var_name)
to_var_name = something(to_var_name, from_var_name)
Expand All @@ -81,7 +82,8 @@ function delete_wires!(a::AbstractAlgebraicAgent;
from::T,
to::T,
from_var_name = nothing,
to_var_name = nothing) where {T <: Union{AbstractAlgebraicAgent, AbstractString, UUID}}
to_var_name = nothing) where {T <:
Union{AbstractAlgebraicAgent, AbstractString, UUID}}
from, to = to_agent(a, from), to_agent(a, to)

ixs = findall(x -> x.from == from && x.to == to, getopera(a).wires)
Expand Down
8 changes: 5 additions & 3 deletions test/agents.jl
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ end
system_dump = AlgebraicAgents.save(system)

@test system_dump == Dict{String, Any}("name" => "diagram",
"inners" => Dict{String, Any}[Dict("name" => "agent1",
"inners" => Dict{String, Any}[
Dict("name" => "agent1",
"arguments" => [1],
"type" => MyAgentLoadsave),
Dict("name" => "agent2", "arguments" => [2], "type" => MyAgentLoadsave)],
Expand All @@ -123,8 +124,9 @@ end
agent1 = inners(system_reloaded)["agent1"]
@test agent1 isa MyAgentLoadsave

opera_dump = Dict("instantious" => [
Dict("call" => () -> println("instantious interaction")),
opera_dump = Dict(
"instantious" => [
Dict("call" => () -> println("instantious interaction"))
],
"futures" => [Dict("time" => 2.0, "call" => () -> println("future"))],
"controls" => [Dict("call" => () -> println("control"))])
Expand Down

0 comments on commit e97c53f

Please sign in to comment.