Skip to content

Commit

Permalink
Apply lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
rht committed Jan 11, 2024
1 parent 1f55c85 commit 962a97f
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 23 deletions.
3 changes: 1 addition & 2 deletions examples/boid_flockers/Flocker Test.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@
},
"outputs": [],
"source": [
"from boid_flockers.model import BoidFlockers\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"from boid_flockers.model import BoidFlockers\n",
"\n",
"%matplotlib inline"
]
Expand Down
2 changes: 0 additions & 2 deletions examples/el_farol/el_farol.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
"outputs": [],
"source": [
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"import seaborn as sns\n",
"\n",
"from el_farol.model import ElFarolBar"
]
},
Expand Down
3 changes: 0 additions & 3 deletions examples/epstein_civil_violence/Epstein Civil Violence.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,8 @@
"metadata": {},
"outputs": [],
"source": [
"import matplotlib.pyplot as plt\n",
"\n",
"%matplotlib inline\n",
"\n",
"from epstein_civil_violence.agent import Citizen, Cop\n",
"from epstein_civil_violence.model import EpsteinCivilViolence"
]
},
Expand Down
11 changes: 5 additions & 6 deletions examples/forest_fire/Forest Fire Model.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,16 @@
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"\n",
"%matplotlib inline\n",
"\n",
"from mesa import Model, Agent\n",
"from mesa.time import RandomActivation\n",
"from mesa.space import Grid\n",
"from mesa import Agent, Model\n",
"from mesa.batchrunner import BatchRunner\n",
"from mesa.datacollection import DataCollector\n",
"from mesa.batchrunner import BatchRunner"
"from mesa.space import Grid\n",
"from mesa.time import RandomActivation"
]
},
{
Expand Down
9 changes: 3 additions & 6 deletions examples/pd_grid/analysis.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,9 @@
"metadata": {},
"outputs": [],
"source": [
"from pd_grid.model import PdGrid\n",
"\n",
"import numpy as np\n",
"\n",
"import matplotlib.pyplot as plt\n",
"import matplotlib.gridspec\n",
"import numpy as np\n",
"from pd_grid.model import PdGrid\n",
"\n",
"%matplotlib inline"
]
Expand Down Expand Up @@ -75,7 +72,7 @@
" grid[y][x] = 0\n",
" ax.pcolormesh(grid, cmap=bwr, vmin=0, vmax=1)\n",
" ax.axis(\"off\")\n",
" ax.set_title(\"Steps: {}\".format(model.schedule.steps))"
" ax.set_title(f\"Steps: {model.schedule.steps}\")"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion examples/wolf_sheep/wolf_sheep/agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def step(self):

# If there is grass available, eat it
this_cell = self.model.grid.get_cell_list_contents([self.pos])
grass_patch = [obj for obj in this_cell if isinstance(obj, GrassPatch)][0]
grass_patch = next(obj for obj in this_cell if isinstance(obj, GrassPatch))
if grass_patch.fully_grown:
self.energy += self.model.sheep_gain_from_food
grass_patch.fully_grown = False
Expand Down
6 changes: 3 additions & 3 deletions gis/agents_and_networks/src/model/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,9 @@ def _load_buildings_from_file(
buildings_df = buildings_df.set_crs(self.data_crs, allow_override=True).to_crs(
crs
)
buildings_df["centroid"] = [
(x, y) for x, y in zip(buildings_df.centroid.x, buildings_df.centroid.y)
]
buildings_df["centroid"] = list(
zip(buildings_df.centroid.x, buildings_df.centroid.y)
)
building_creator = mg.AgentCreator(Building, model=self)
buildings = building_creator.from_GeoDataFrame(buildings_df)
self.space.add_buildings(buildings)
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ extend-ignore = [
]
# Hardcode to Python 3.8.
target-version = "py38"
extend-include = ["*.ipynb"]

[tool.isort]
profile = "black"
Expand Down

0 comments on commit 962a97f

Please sign in to comment.