Skip to content

Commit b8af9e2

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 04d3eed commit b8af9e2

File tree

3 files changed

+11
-12
lines changed

3 files changed

+11
-12
lines changed

examples/hotelling_law/hotelling_law/agents.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@ def adjust_price(self):
3737

3838
# adjust price dynamics based on neighbouring store
3939
def adjust_price_by_neighbour_store(self):
40-
neighbors = (self.model.grid.get_neighbors
41-
(self.pos, moore=True, include_center=False))
40+
neighbors = self.model.grid.get_neighbors(
41+
self.pos, moore=True, include_center=False
42+
)
4243
if not neighbors:
4344
return # No adjustment if there are no neighbors
4445

45-
avg_neighbor_price = np.mean([neighbor.price for
46-
neighbor in neighbors])
46+
avg_neighbor_price = np.mean([neighbor.price for neighbor in neighbors])
4747
price_difference = self.price - avg_neighbor_price
4848

4949
# Strategy: Narrow the price gap if it's significantly

examples/hotelling_law/hotelling_law/server.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
# Import the model and visualization elements defined
77
# in other files of the project.
88
from .model import HotellingModel
9-
from .visualization import (agent_portrayal,
10-
average_price_chart, total_revenue_chart)
9+
from .visualization import agent_portrayal, average_price_chart, total_revenue_chart
1110

1211
# Define the size of the grid that will be used for visualizing
1312
# the simulation in the web interface.

examples/hotelling_law/tests.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ def test_price_variance_behavior(expected_to_increase=True):
3131

3232
# Checking if the slope of the price variance is as expected
3333
if expected_to_increase:
34-
assert check_slope(df_model["Price Variance"],
35-
increasing=True), \
36-
"The price variance should increase over time, but it did not."
34+
assert check_slope(
35+
df_model["Price Variance"], increasing=True
36+
), "The price variance should increase over time, but it did not."
3737
else:
38-
assert check_slope(df_model["Price Variance"],
39-
increasing=False), \
40-
"The price variance should decrease over time, but it did not."
38+
assert check_slope(
39+
df_model["Price Variance"], increasing=False
40+
), "The price variance should decrease over time, but it did not."

0 commit comments

Comments
 (0)