Skip to content

Commit

Permalink
NetCon can set multiple weights if an iterator is provided.
Browse files Browse the repository at this point in the history
  • Loading branch information
Helveg committed Oct 11, 2020
1 parent 0b16107 commit 803cd4f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion patch/interpreter.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,11 @@ def NetCon(self, source, target, *args, **kwargs):
# Set the weight, delay and threshold independently
for k, v in setters.items():
if k == "weight":
connection.weight[0] = v
if hasattr(type(v), "__iter__"): # pragma: nocover
for i, w in enumerate(v):
connection.weight[i] = w
else:
connection.weight[0] = v
else:
setattr(connection, k, v)
# Have the NetCon reference source and target
Expand Down

0 comments on commit 803cd4f

Please sign in to comment.