Skip to content

Commit

Permalink
If a single agent, convert to list
Browse files Browse the repository at this point in the history
  • Loading branch information
EwoutH authored Dec 23, 2023
1 parent f9c870d commit aad2183
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/mesa_interactive/components/grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
def get_agent_data_from_coord_iter(agents_per_coordinate):
for agents, (x, y) in agents_per_coordinate:
if agents: # Checking if the list is non-empty
if agents not isinstance(list):
agents = [agents]
for agent in agents:
agent_data = json.loads(
json.dumps(agent.__dict__, skipkeys=True, default=str)
Expand Down

0 comments on commit aad2183

Please sign in to comment.