From dbc182c6d0904f7cd6458c355230f77420a97ce0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=2E=20Fernando=20S=C3=A1nchez?= Date: Mon, 9 Oct 2017 14:44:21 +0200 Subject: [PATCH] Compatibility with py3.4 --- Dockerfile | 2 +- docs/installation.rst | 2 +- soil/__init__.py | 2 +- soil/environment.py | 7 +++---- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index dd9b9d5..5391343 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,3 @@ -FROM python:3.5-onbuild +FROM python:3.4-onbuild ENTRYPOINT ["python", "-m", "soil"] diff --git a/docs/installation.rst b/docs/installation.rst index a1fddd4..1daa84d 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -1,7 +1,7 @@ Installation ------------ -The easiest way to install Soil is through pip: +The easiest way to install Soil is through pip, with Python >= 3.4: .. code:: bash diff --git a/soil/__init__.py b/soil/__init__.py index fddebb8..7a14b1c 100644 --- a/soil/__init__.py +++ b/soil/__init__.py @@ -2,7 +2,7 @@ import importlib import sys import os -__version__ = "0.9.6" +__version__ = "0.9.7" try: basestring diff --git a/soil/environment.py b/soil/environment.py index 3317cf6..377e084 100644 --- a/soil/environment.py +++ b/soil/environment.py @@ -50,8 +50,7 @@ class SoilEnvironment(nxsim.NetworkEnvironment): atype = kwargs.pop('agent_type') kwargs['agent_id'] = kwargs.get('agent_id', atype.__name__) kwargs['state'] = kwargs.get('state', {}) - a = atype(**kwargs, - environment=self) + a = atype(environment=self, **kwargs) self._env_agents[a.id] = weakref.ref(a) @property @@ -160,7 +159,7 @@ class SoilEnvironment(nxsim.NetworkEnvironment): spells = [] lastvisible = False laststep = None - for t_step, state in reversed(agent._history.items()): + for t_step, state in reversed(list(agent._history.items())): for attribute, value in state.items(): if attribute == 'visible': nowvisible = state[attribute] @@ -183,7 +182,7 @@ class SoilEnvironment(nxsim.NetworkEnvironment): if lastvisible: spells.append((laststep, None)) if spells: - G.add_node(agent.id, **attributes, spells=spells) + G.add_node(agent.id, spells=spells, **attributes) else: G.add_node(agent.id, **attributes)