Skip to content

Commit 2a1ae90

Browse files
committed
Apply lint fixes
1 parent 874f3c2 commit 2a1ae90

File tree

8 files changed

+16
-25
lines changed

8 files changed

+16
-25
lines changed

examples/boid_flockers/Flocker Test.ipynb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@
88
},
99
"outputs": [],
1010
"source": [
11-
"from boid_flockers.model import BoidFlockers\n",
12-
"import numpy as np\n",
1311
"import matplotlib.pyplot as plt\n",
12+
"from boid_flockers.model import BoidFlockers\n",
1413
"\n",
1514
"%matplotlib inline"
1615
]

examples/el_farol/el_farol.ipynb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@
77
"outputs": [],
88
"source": [
99
"import matplotlib.pyplot as plt\n",
10-
"import numpy as np\n",
1110
"import seaborn as sns\n",
12-
"\n",
1311
"from el_farol.model import ElFarolBar"
1412
]
1513
},

examples/epstein_civil_violence/Epstein Civil Violence.ipynb

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,8 @@
1717
"metadata": {},
1818
"outputs": [],
1919
"source": [
20-
"import matplotlib.pyplot as plt\n",
21-
"\n",
2220
"%matplotlib inline\n",
2321
"\n",
24-
"from epstein_civil_violence.agent import Citizen, Cop\n",
2522
"from epstein_civil_violence.model import EpsteinCivilViolence"
2623
]
2724
},

examples/forest_fire/Forest Fire Model.ipynb

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,16 @@
2727
"metadata": {},
2828
"outputs": [],
2929
"source": [
30-
"import numpy as np\n",
31-
"\n",
3230
"import matplotlib.pyplot as plt\n",
31+
"import numpy as np\n",
3332
"\n",
3433
"%matplotlib inline\n",
3534
"\n",
36-
"from mesa import Model, Agent\n",
37-
"from mesa.time import RandomActivation\n",
38-
"from mesa.space import Grid\n",
35+
"from mesa import Agent, Model\n",
36+
"from mesa.batchrunner import BatchRunner\n",
3937
"from mesa.datacollection import DataCollector\n",
40-
"from mesa.batchrunner import BatchRunner"
38+
"from mesa.space import Grid\n",
39+
"from mesa.time import RandomActivation"
4140
]
4241
},
4342
{
@@ -327,9 +326,9 @@
327326
"metadata": {},
328327
"outputs": [],
329328
"source": [
330-
"fixed_params = dict(height=50, width=50) # Height and width are constant\n",
329+
"fixed_params = {\"height\": 50, \"width\": 50} # Height and width are constant\n",
331330
"# Vary density from 0.01 to 1, in 0.01 increments:\n",
332-
"variable_params = dict(density=np.linspace(0, 1, 101)[1:])"
331+
"variable_params = {\"density\": np.linspace(0, 1, 101)[1:]}"
333332
]
334333
},
335334
{

examples/pd_grid/analysis.ipynb

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,9 @@
3434
"metadata": {},
3535
"outputs": [],
3636
"source": [
37-
"from pd_grid.model import PdGrid\n",
38-
"\n",
39-
"import numpy as np\n",
40-
"\n",
4137
"import matplotlib.pyplot as plt\n",
42-
"import matplotlib.gridspec\n",
38+
"import numpy as np\n",
39+
"from pd_grid.model import PdGrid\n",
4340
"\n",
4441
"%matplotlib inline"
4542
]
@@ -75,7 +72,7 @@
7572
" grid[y][x] = 0\n",
7673
" ax.pcolormesh(grid, cmap=bwr, vmin=0, vmax=1)\n",
7774
" ax.axis(\"off\")\n",
78-
" ax.set_title(\"Steps: {}\".format(model.schedule.steps))"
75+
" ax.set_title(f\"Steps: {model.schedule.steps}\")"
7976
]
8077
},
8178
{

examples/wolf_sheep/wolf_sheep/agents.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def step(self):
2929

3030
# If there is grass available, eat it
3131
this_cell = self.model.grid.get_cell_list_contents([self.pos])
32-
grass_patch = [obj for obj in this_cell if isinstance(obj, GrassPatch)][0]
32+
grass_patch = next(obj for obj in this_cell if isinstance(obj, GrassPatch))
3333
if grass_patch.fully_grown:
3434
self.energy += self.model.sheep_gain_from_food
3535
grass_patch.fully_grown = False

gis/agents_and_networks/src/model/model.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,9 @@ def _load_buildings_from_file(
156156
buildings_df = buildings_df.set_crs(self.data_crs, allow_override=True).to_crs(
157157
crs
158158
)
159-
buildings_df["centroid"] = [
160-
(x, y) for x, y in zip(buildings_df.centroid.x, buildings_df.centroid.y)
161-
]
159+
buildings_df["centroid"] = list(
160+
zip(buildings_df.centroid.x, buildings_df.centroid.y)
161+
)
162162
building_creator = mg.AgentCreator(Building, model=self)
163163
buildings = building_creator.from_GeoDataFrame(buildings_df)
164164
self.space.add_buildings(buildings)

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ extend-ignore = [
6969
]
7070
# Hardcode to Python 3.8.
7171
target-version = "py38"
72+
extend-include = ["*.ipynb"]
7273

7374
[tool.isort]
7475
profile = "black"

0 commit comments

Comments
 (0)