Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] authored and quaquel committed Oct 23, 2024
1 parent 86daebc commit 9c0bdc4
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions mesa/visualization/components/altair.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ def SpaceAltair(model, agent_portrayal, dependencies: list[any] | None = None):
# Sometimes the space is defined as model.space instead of model.grid
space = model.space


chart = _draw_grid(space, agent_portrayal)
solara.FigureAltair(chart)

Expand Down Expand Up @@ -64,7 +63,7 @@ def _get_agent_data_old__discrete_space(space, agent_portrayal):
return all_agent_data


def _get_agent_data_new_discrete_space(space:DiscreteSpace, agent_portrayal):
def _get_agent_data_new_discrete_space(space: DiscreteSpace, agent_portrayal):
"""Format agent portrayal data for new-style discrete spaces.
Args:
Expand All @@ -86,7 +85,7 @@ def _get_agent_data_new_discrete_space(space:DiscreteSpace, agent_portrayal):
return all_agent_data


def _get_agent_data_continous_space(space:ContinuousSpace, agent_portrayal):
def _get_agent_data_continous_space(space: ContinuousSpace, agent_portrayal):
"""Format agent portrayal data for contiuous space.
Args:
Expand All @@ -106,8 +105,8 @@ def _get_agent_data_continous_space(space:ContinuousSpace, agent_portrayal):
all_agent_data.append(agent)
return all_agent_data

def _draw_grid(space, agent_portrayal):

def _draw_grid(space, agent_portrayal):
match space:
case Grid():
all_agent_data = _get_agent_data_new_discrete_space(space, agent_portrayal)
Expand All @@ -116,7 +115,9 @@ def _draw_grid(space, agent_portrayal):
case ContinuousSpace():
all_agent_data = _get_agent_data_continous_space(space, agent_portrayal)
case _:
raise NotImplementedError(f"visualizing {type(space)} is currently not supported through altair")
raise NotImplementedError(
f"visualizing {type(space)} is currently not supported through altair"
)

invalid_tooltips = ["color", "size", "x", "y"]

Expand Down

0 comments on commit 9c0bdc4

Please sign in to comment.