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] committed Sep 25, 2024
1 parent 27313ec commit 5ccf584
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions benchmarks/BoltzmannWealth/boltzmann_wealth.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,17 @@ def get_agent_wealth(model): # noqa D103
return [agent.wealth for agent in model.agents]



class Collector:
def __init__(self, model, obj, attr):
self.data = []
self.obj = obj
self.attr = attr
self.model = model

def collect(self):
self.data.append(getattr(self.obj, self.attr))


class Table:
def __init__(self, model: BoltzmannWealth):
self.data = {}
Expand Down Expand Up @@ -78,8 +79,10 @@ def __init__(self, seed=None, n=100, width=10, height=10): # noqa D103
self.gini = Computed(compute_gini, self)

self.running = True
self.datacollector = [Collector(self, self, "gini"),
Collector(self, self, "agent_wealth")]
self.datacollector = [
Collector(self, self, "gini"),
Collector(self, self, "agent_wealth"),
]

def step(self): # noqa D103
self.agents.shuffle_do("step") # collect data
Expand Down

0 comments on commit 5ccf584

Please sign in to comment.