Skip to content

Commit 6e53612

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 06b0998 commit 6e53612

File tree

5 files changed

+13
-8
lines changed

5 files changed

+13
-8
lines changed

benchmarks/BoltzmannWealth/boltzmann_wealth.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import mesa
77
import mesa.spaces as spaces
88

9+
910
def compute_gini(model):
1011
"""Calculate gini for wealth in model.
1112
@@ -88,7 +89,7 @@ def __init__(self, model):
8889
self.wealth = 1
8990

9091
def give_money(self):
91-
cellmates = [agent for agent in self.cell.agents if not agent is self]
92+
cellmates = [agent for agent in self.cell.agents if agent is not self]
9293
if len(cellmates) > 0:
9394
other = self.random.choice(cellmates)
9495
other.wealth += 1
@@ -101,7 +102,7 @@ def step(self):
101102
self.give_money()
102103

103104

104-
if __name__ == '__main__':
105+
if __name__ == "__main__":
105106
model = BoltzmannWealth()
106107
for _ in range(10):
107-
model.step()
108+
model.step()

mesa/__init__.py

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

88
import mesa.space as old_space
9+
910
# import mesa.spaces as spaces
1011
import mesa.time as time
1112
from mesa.agent import Agent

mesa/experimental/components/matplotlib.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
import mesa
1111

1212

13-
1413
@solara.component
1514
def SpaceMatplotlib(model, agent_portrayal, dependencies: list[any] | None = None):
1615
"""A component for rendering a space using Matplotlib.
@@ -164,7 +163,6 @@ def portray(space):
164163

165164

166165
def _draw_voronoi(space, space_ax, agent_portrayal):
167-
from mesa.spaces.voronoi import VoronoiGrid
168166
def portray(g):
169167
x = []
170168
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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ def __repr__(self): # noqa
123123

124124
# FIXME: Revisit caching strategy on methods
125125
@cache # noqa: B019
126-
def neighborhood(self, radius=1, include_center=False):
126+
def neighborhood(self, radius=1, include_center=False): -> CellCollection:
127127
"""Returns a list of all neighboring cells."""
128128
return CellCollection(
129129
self._neighborhood(radius=radius, include_center=include_center),

0 commit comments

Comments
 (0)