Skip to content

Commit 6f9748d

Browse files
pre-commit-ci[bot]quaquel
authored andcommitted
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 1096760 commit 6f9748d

File tree

5 files changed

+15
-8
lines changed

5 files changed

+15
-8
lines changed

benchmarks/BoltzmannWealth/boltzmann_wealth.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import mesa
33
import mesa.spaces as spaces
44

5+
56
def compute_gini(model):
67
agent_wealths = [agent.wealth for agent in model.agents]
78
x = sorted(agent_wealths)
@@ -62,7 +63,7 @@ def __init__(self, model):
6263
# self.model.grid.move_agent(self, new_position)
6364

6465
def give_money(self):
65-
cellmates = [agent for agent in self.cell.agents if not agent is self]
66+
cellmates = [agent for agent in self.cell.agents if agent is not self]
6667
if len(cellmates) > 0:
6768
other = self.random.choice(cellmates)
6869
other.wealth += 1
@@ -74,7 +75,7 @@ def step(self):
7475
self.give_money()
7576

7677

77-
if __name__ == '__main__':
78+
if __name__ == "__main__":
7879
model = BoltzmannWealth()
7980
for _ in range(10):
80-
model.step()
81+
model.step()

mesa/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import datetime
88

99
import mesa.space as old_space
10+
1011
# import mesa.spaces as spaces
1112
import mesa.time as time
1213
from mesa.agent import Agent

mesa/experimental/components/matplotlib.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import mesa
99

1010

11-
1211
@solara.component
1312
def SpaceMatplotlib(model, agent_portrayal, dependencies: list[any] | None = None):
1413
space_fig = Figure()
@@ -154,7 +153,6 @@ def portray(space):
154153

155154

156155
def _draw_voronoi(space, space_ax, agent_portrayal):
157-
from mesa.spaces.voronoi import VoronoiGrid
158156
def portray(g):
159157
x = []
160158
y = []

mesa/spaces/__init__.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
1-
from mesa.spaces.network import Network
21
from mesa.spaces.cell import Cell
32
from mesa.spaces.cell_agent import CellAgent
43
from mesa.spaces.cell_collection import CellCollection
54
from mesa.spaces.discrete_space import DiscreteSpace
6-
from mesa.spaces.grid import Grid, HexGrid, OrthogonalMooreGrid, OrthogonalVonNeumannGrid
5+
from mesa.spaces.grid import (
6+
Grid,
7+
HexGrid,
8+
OrthogonalMooreGrid,
9+
OrthogonalVonNeumannGrid,
10+
)
11+
from mesa.spaces.network import Network
712
from mesa.spaces.voronoi import VoronoiGrid
813

914
__all__ = [

mesa/spaces/cell.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,9 @@ def __repr__(self):
121121

122122
# FIXME: Revisit caching strategy on methods
123123
@cache # noqa: B019
124-
def neighborhood(self, radius: int = 1, include_center: bool = False) -> CellCollection:
124+
def neighborhood(
125+
self, radius: int = 1, include_center: bool = False
126+
) -> CellCollection:
125127
# FIXME? if this is a method rather than a property, should it not be get_neighborhood?
126128
# FIXME:: operating on this has side effects!
127129
return CellCollection(

0 commit comments

Comments
 (0)