mirror of
https://github.com/gsi-upm/soil
synced 2024-11-22 03:02:28 +00:00
Compatibility with py3.4
This commit is contained in:
parent
eafecc9e5e
commit
dbc182c6d0
@ -1,3 +1,3 @@
|
|||||||
FROM python:3.5-onbuild
|
FROM python:3.4-onbuild
|
||||||
|
|
||||||
ENTRYPOINT ["python", "-m", "soil"]
|
ENTRYPOINT ["python", "-m", "soil"]
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
Installation
|
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
|
.. code:: bash
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ import importlib
|
|||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
|
|
||||||
__version__ = "0.9.6"
|
__version__ = "0.9.7"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
basestring
|
basestring
|
||||||
|
@ -50,8 +50,7 @@ class SoilEnvironment(nxsim.NetworkEnvironment):
|
|||||||
atype = kwargs.pop('agent_type')
|
atype = kwargs.pop('agent_type')
|
||||||
kwargs['agent_id'] = kwargs.get('agent_id', atype.__name__)
|
kwargs['agent_id'] = kwargs.get('agent_id', atype.__name__)
|
||||||
kwargs['state'] = kwargs.get('state', {})
|
kwargs['state'] = kwargs.get('state', {})
|
||||||
a = atype(**kwargs,
|
a = atype(environment=self, **kwargs)
|
||||||
environment=self)
|
|
||||||
self._env_agents[a.id] = weakref.ref(a)
|
self._env_agents[a.id] = weakref.ref(a)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -160,7 +159,7 @@ class SoilEnvironment(nxsim.NetworkEnvironment):
|
|||||||
spells = []
|
spells = []
|
||||||
lastvisible = False
|
lastvisible = False
|
||||||
laststep = None
|
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():
|
for attribute, value in state.items():
|
||||||
if attribute == 'visible':
|
if attribute == 'visible':
|
||||||
nowvisible = state[attribute]
|
nowvisible = state[attribute]
|
||||||
@ -183,7 +182,7 @@ class SoilEnvironment(nxsim.NetworkEnvironment):
|
|||||||
if lastvisible:
|
if lastvisible:
|
||||||
spells.append((laststep, None))
|
spells.append((laststep, None))
|
||||||
if spells:
|
if spells:
|
||||||
G.add_node(agent.id, **attributes, spells=spells)
|
G.add_node(agent.id, spells=spells, **attributes)
|
||||||
else:
|
else:
|
||||||
G.add_node(agent.id, **attributes)
|
G.add_node(agent.id, **attributes)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user