Skip to content

Commit 5c382ac

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 08ec008 commit 5c382ac

File tree

4 files changed

+10
-7
lines changed
  • examples
    • bank_reserves
    • boltzmann_wealth_model_experimental
    • boltzmann_wealth_model_network/boltzmann_wealth_model_network
    • boltzmann_wealth_model/boltzmann_wealth_model

4 files changed

+10
-7
lines changed

examples/bank_reserves/batch_run.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
every step of every run.
2525
"""
2626

27-
2827
import mesa
2928
import pandas as pd
3029
from bank_reserves.model import BankReservesModel

examples/boltzmann_wealth_model/boltzmann_wealth_model/model.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ class BoltzmannWealthModel(mesa.Model):
2020
def __init__(self, N=100, width=10, height=10):
2121
super().__init__()
2222
self.num_agents = N
23-
self.grid = mesa.spaces.OrthogonalMooreGrid((width, height), torus=True, random=self.random)
23+
self.grid = mesa.spaces.OrthogonalMooreGrid(
24+
(width, height), torus=True, random=self.random
25+
)
2426

2527
self.datacollector = mesa.DataCollector(
2628
model_reporters={"Gini": compute_gini}, agent_reporters={"Wealth": "wealth"}
@@ -32,7 +34,7 @@ def __init__(self, N=100, width=10, height=10):
3234
# Add the agent to a random grid cell
3335
x = self.random.randrange(width)
3436
y = self.random.randrange(height)
35-
agent.move_to(self.grid[(x,y)])
37+
agent.move_to(self.grid[(x, y)])
3638

3739
self.running = True
3840
self.datacollector.collect(self)
@@ -55,7 +57,9 @@ def __init__(self, model):
5557
self.wealth = 1
5658

5759
def give_money(self):
58-
cellmates = [agent for agent in self.cell.agents if agent is not self] # Ensure agent is not giving money to itself
60+
cellmates = [
61+
agent for agent in self.cell.agents if agent is not self
62+
] # Ensure agent is not giving money to itself
5963
if len(cellmates) > 0:
6064
other = self.random.choice(cellmates)
6165
other.wealth += 1

examples/boltzmann_wealth_model_experimental/model.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ class BoltzmannWealthModel(mesa.Model):
2020
def __init__(self, N=100, width=10, height=10):
2121
super().__init__()
2222
self.num_agents = N
23-
self.grid = mesa.spaces.OrthogonalMooreGrid((width, height), torus=True, random=self.random)
23+
self.grid = mesa.spaces.OrthogonalMooreGrid(
24+
(width, height), torus=True, random=self.random
25+
)
2426

2527
self.datacollector = mesa.DataCollector(
2628
model_reporters={"Gini": compute_gini}, agent_reporters={"Wealth": "wealth"}

examples/boltzmann_wealth_model_network/boltzmann_wealth_model_network/model.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ def __init__(self, num_agents=7, num_nodes=10):
2020
self.G = nx.erdos_renyi_graph(n=self.num_nodes, p=0.5)
2121
self.grid = mesa.spaces.Network(self.G, random=self.random, capacity=1)
2222

23-
2423
self.datacollector = mesa.DataCollector(
2524
model_reporters={"Gini": compute_gini},
2625
agent_reporters={"Wealth": lambda _: _.wealth},
@@ -55,7 +54,6 @@ def __init__(self, model):
5554
super().__init__(model)
5655
self.wealth = 1
5756

58-
5957
def give_money(self):
6058
neighbors = [agent for agent in self.cell.neighborhood().agents if not self]
6159
if len(neighbors) > 0:

0 commit comments

Comments
 (0)