1
0
mirror of https://github.com/gsi-upm/soil synced 2025-09-15 04:32:21 +00:00

Fix py3.4 and pypi bugs

This commit is contained in:
J. Fernando Sánchez
2017-10-19 18:28:17 +02:00
parent a7c51742f6
commit a4b32afa2f
5 changed files with 10 additions and 104 deletions

View File

@@ -145,15 +145,13 @@ class SoilEnvironment(nxsim.NetworkEnvironment):
def __getitem__(self, key):
if isinstance(key, tuple):
values = {"agent_id": key[0],
"t_step": key[1],
"key": key[2],
"value": None,
"value_type": None
}
fields = list(k for k, v in values.items() if v is None)
conditions = " and ".join("{}='{}'".format(k, v) for k, v in values.items() if v is not None)
values = [("agent_id", key[0]),
("t_step", key[1]),
("key", key[2]),
("value", None),
("value_type", None)]
fields = list(k for k, v in values if v is None)
conditions = " and ".join("{}='{}'".format(k, v) for k, v in values if v is not None)
query = """SELECT {fields} from history""".format(fields=",".join(fields))
if conditions: