Skip to content

Commit

Permalink
Implemented Extend action for NumPy array
Browse files Browse the repository at this point in the history
  • Loading branch information
jooste committed Sep 11, 2023
1 parent f267075 commit 2a821ae
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions bluesky/network/sharedstate.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,14 @@ def receive(action, data):
container.append(item)

elif ctx.action == ActionType.Extend:
# TODO: other types? (ndarray, ...)
for key, item in data.items():
container = getattr(store, key, None)
if container is None:
setattr(store, key, item)
else:
elif isinstance(container, list):
container.extend(item)
elif isinstance(container, np.ndarray):
setattr(store, key, np.concatenate([container, item]))

elif ctx.action == ActionType.Replace:
vars(store).update(data)
Expand Down

0 comments on commit 2a821ae

Please sign in to comment.