Skip to content

Commit

Permalink
Merge pull request projectmesa#1040 from jackiekazil/main
Browse files Browse the repository at this point in the history
release v0.8.9 Oro Valley
  • Loading branch information
tpike3 authored May 23, 2021
2 parents bbf1b88 + 3aee0b7 commit f83daff
Show file tree
Hide file tree
Showing 18 changed files with 94 additions and 69 deletions.
29 changes: 27 additions & 2 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,37 @@
Release History
---------------


0.8.9 (TBD) Oro Valley
0.8.9 (2020-05-22) Oro Valley
+++++++++++++++++++++++++++++++++++++++++++

*Note: Master branch was renamed to Main on 03/13/2021*

**Improvements**

* Master to Main change:
* Docs/examples: Update links to use main instead of master as branch #1012
* CI: Run on pushed to main and release branches #1011
* Github Actions
* GitHub Actions: run black only on ubuntu 3.8 #996
* GA: Only run CI when pushed to master #974
* GA: Add pypy3 #972
* rename github action to "build", remove redundant flake8 check #971
* GA: Run on Windows and macOS #970
* Add GitHub Action for continuous integration testing #966
* [PERF] Add neighborhood cache to grids and improve iter_cell_list_contents #823
* forest_fire: Remove unnecessary code #981
* Migrate away from type comments #984
* Update License #985
* Public remove_agent function for NetworkGrid #1001
* Date update to release #962
* Advanced indexing of grid #820

**Fixes**

* Correct spelling #999
* Update Pipfile.lock #983
* Fix order of variable_params in model and agent vars data frames #979
* Fix asyncio on windows with python 3.6 #973


0.8.8 (2020-11-27) Nogales
Expand Down
2 changes: 1 addition & 1 deletion examples/bank_reserves/bank_reserves/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@


def get_num_rich_agents(model):
""" return number of rich agents"""
"""return number of rich agents"""

rich_agents = [a for a in model.schedule.agents if a.savings > model.rich_threshold]
return len(rich_agents)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def run_model(self, n):


class MoneyAgent(Agent):
""" An agent with fixed initial wealth."""
"""An agent with fixed initial wealth."""

def __init__(self, unique_id, model):
super().__init__(unique_id, model)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def run_model(self, n):


class MoneyAgent(Agent):
""" An agent with fixed initial wealth."""
"""An agent with fixed initial wealth."""

def __init__(self, unique_id, model):
super().__init__(unique_id, model)
Expand Down
2 changes: 1 addition & 1 deletion examples/charts/charts/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@


def get_num_rich_agents(model):
""" return number of rich agents"""
"""return number of rich agents"""

rich_agents = [a for a in model.schedule.agents if a.savings > model.rich_threshold]
return len(rich_agents)
Expand Down
4 changes: 2 additions & 2 deletions examples/pd_grid/pd_grid/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


class PDAgent(Agent):
""" Agent member of the iterated, spatial prisoner's dilemma model. """
"""Agent member of the iterated, spatial prisoner's dilemma model."""

def __init__(self, pos, model, starting_move=None):
"""
Expand All @@ -28,7 +28,7 @@ def isCooroperating(self):
return self.move == "C"

def step(self):
""" Get the neighbors' moves, and change own move accordingly. """
"""Get the neighbors' moves, and change own move accordingly."""
neighbors = self.model.grid.get_neighbors(self.pos, True, include_center=True)
best_neighbor = max(neighbors, key=lambda a: a.score)
self.next_move = best_neighbor.move
Expand Down
4 changes: 2 additions & 2 deletions examples/pd_grid/pd_grid/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


class PdGrid(Model):
""" Model class for iterated, spatial prisoner's dilemma model. """
"""Model class for iterated, spatial prisoner's dilemma model."""

schedule_types = {
"Sequential": BaseScheduler,
Expand Down Expand Up @@ -60,6 +60,6 @@ def step(self):
self.datacollector.collect(self)

def run(self, n):
""" Run the model for n steps. """
"""Run the model for n steps."""
for _ in range(n):
self.step()
2 changes: 1 addition & 1 deletion examples/schelling/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class Schelling(Model):
"""

def __init__(self, height=20, width=20, density=0.8, minority_pc=0.2, homophily=3):
""""""
""" """

self.height = height
self.width = width
Expand Down
2 changes: 1 addition & 1 deletion mesa/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
__all__ = ["Model", "Agent"]

__title__ = "mesa"
__version__ = "0.8.8.1"
__version__ = "0.8.9"
__license__ = "Apache 2.0"
__copyright__ = "Copyright %s Project Mesa Team" % datetime.date.today().year
6 changes: 3 additions & 3 deletions mesa/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@


class Agent:
""" Base class for a model agent. """
"""Base class for a model agent."""

def __init__(self, unique_id: int, model: Model) -> None:
""" Create a new agent. """
"""Create a new agent."""
self.unique_id = unique_id
self.model = model
self.pos = None

def step(self) -> None:
""" A single step of the agent. """
"""A single step of the agent."""
pass

def advance(self) -> None:
Expand Down
8 changes: 4 additions & 4 deletions mesa/batchrunner.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def _make_model_args(self):
return total_iterations, all_kwargs, all_param_values

def run_all(self):
""" Run the model at all parameter combinations and store results. """
"""Run the model at all parameter combinations and store results."""
run_count = count()
total_iterations, all_kwargs, all_param_values = self._make_model_args()

Expand Down Expand Up @@ -210,15 +210,15 @@ def run_model(self, model):
return None

def collect_model_vars(self, model):
""" Run reporters and collect model-level variables. """
"""Run reporters and collect model-level variables."""
model_vars = OrderedDict()
for var, reporter in self.model_reporters.items():
model_vars[var] = reporter(model)

return model_vars

def collect_agent_vars(self, model):
""" Run reporters and collect agent-level variables. """
"""Run reporters and collect agent-level variables."""
agent_vars = OrderedDict()
for agent in model.schedule._agents.values():
agent_record = OrderedDict()
Expand Down Expand Up @@ -412,7 +412,7 @@ def __init__(


class BatchRunnerMP(BatchRunner):
""" Child class of BatchRunner, extended with multiprocessing support. """
"""Child class of BatchRunner, extended with multiprocessing support."""

def __init__(self, model_cls, nr_processes=None, **kwargs):
"""Create a new BatchRunnerMP for a given model with the given
Expand Down
6 changes: 3 additions & 3 deletions mesa/datacollection.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def _new_table(self, table_name, table_columns):
self.tables[table_name] = new_table

def _record_agents(self, model):
""" Record agents data in a mapping of functions and agents. """
"""Record agents data in a mapping of functions and agents."""
rep_funcs = self.agent_reporters.values()
if all([hasattr(rep, "attribute_name") for rep in rep_funcs]):
prefix = ["model.schedule.steps", "unique_id"]
Expand All @@ -174,7 +174,7 @@ def _reporter_decorator(self, reporter):
return reporter()

def collect(self, model):
""" Collect all the data for the given model object. """
"""Collect all the data for the given model object."""
if self.model_reporters:

for var, reporter in self.model_reporters.items():
Expand Down Expand Up @@ -217,7 +217,7 @@ def add_table_row(self, table_name, row, ignore_missing=False):

@staticmethod
def _getattr(name, _object):
""" Turn around arguments of getattr to make it partially callable."""
"""Turn around arguments of getattr to make it partially callable."""
return getattr(_object, name, None)

def get_model_vars_dataframe(self):
Expand Down
6 changes: 3 additions & 3 deletions mesa/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@


class Model:
""" Base class for models. """
"""Base class for models."""

def __new__(cls, *args: Any, **kwargs: Any) -> Any:
"""Create a new model object and instantiate its RNG automatically."""
Expand Down Expand Up @@ -42,11 +42,11 @@ def run_model(self) -> None:
self.step()

def step(self) -> None:
""" A single step. Fill in here. """
"""A single step. Fill in here."""
pass

def next_id(self) -> int:
""" Return the next unique ID for agents, increment current_id"""
"""Return the next unique ID for agents, increment current_id"""
self.current_id += 1
return self.current_id

Expand Down
Loading

0 comments on commit f83daff

Please sign in to comment.