Skip to content

Commit

Permalink
Fix N803 and N806 ruff errors in basic examples
Browse files Browse the repository at this point in the history
Fix:
- N803 Argument name should be lowercase: 1 occurrence
- N806 Variable in function should be lowercase: 2 occurrences
  • Loading branch information
EwoutH committed Oct 16, 2024
1 parent dbfc987 commit 4e6e640
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion examples/basic/boltzmann_wealth_model/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def agent_portrayal(agent):


model_params = {
"N": {
"n": {
"type": "SliderInt",
"value": 50,
"label": "Number of agents:",
Expand Down
10 changes: 5 additions & 5 deletions examples/basic/boltzmann_wealth_model/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ class BoltzmannWealthModel(mesa.Model):
highly skewed distribution of wealth.
"""

def __init__(self, N=100, width=10, height=10):
def __init__(self, n=100, width=10, height=10):
super().__init__()
self.num_agents = N
self.num_agents = n
self.grid = mesa.space.MultiGrid(width, height, True)

self.datacollector = mesa.DataCollector(
Expand All @@ -39,6 +39,6 @@ def step(self):
def compute_gini(self):
agent_wealths = [agent.wealth for agent in self.agents]
x = sorted(agent_wealths)
N = self.num_agents
B = sum(xi * (N - i) for i, xi in enumerate(x)) / (N * sum(x))
return 1 + (1 / N) - 2 * B
n = self.num_agents
b = sum(xi * (n - i) for i, xi in enumerate(x)) / (n * sum(x))
return 1 + (1 / n) - 2 * b

0 comments on commit 4e6e640

Please sign in to comment.