Skip to content
Snippets Groups Projects

WIP: GUI version

Merged Sebastian Höffner requested to merge feature/gui into master
2 files
+ 8
2
Compare changes
  • Side-by-side
  • Inline
Files
2
+ 78
0
From b9338215890fba53ca342a1fff27327b23f867ff Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Sebastian=20H=C3=B6ffner?= <info@sebastian-hoeffner.de>
Date: Mon, 13 May 2019 14:48:47 +0200
Subject: [PATCH 1/4] Fixing yaml.load calls.
---
mmlf/__init__.py | 10 +++++-----
mmlf/gui/explorer.py | 6 +++---
mmlf/gui/world_config_editor.py | 4 ++--
3 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/mmlf/__init__.py b/mmlf/__init__.py
index 7fa18c6..60e0a0a 100644
--- a/mmlf/__init__.py
+++ b/mmlf/__init__.py
@@ -164,8 +164,8 @@ def loadWorldFromConfigFile(configPath, useGUI=False):
absConfigPath = configPath
# Load YAML-file
- worldConfigObject = yaml.load(open(absConfigPath, 'r'))
-
+ worldConfigObject = yaml.load(open(absConfigPath, 'r'), Loader=yaml.FullLoader)
+
# Load World
return loadWorld(worldConfigObject, baseUserDir, useGUI=useGUI)
@@ -247,13 +247,13 @@ def loadExperimentConfig(experimentPath):
experimentPath = getRWPath() + os.sep + experimentPath
experimentConfigFile = experimentPath + os.sep + "experiment_config.yaml"
- experimentConf = yaml.load(open(experimentConfigFile, 'r'))
-
+ experimentConf = yaml.load(open(experimentConfigFile, 'r'), Loader=yaml.FullLoader)
+
# Add all worlds specified in this directory to the world list
experimentConf["worlds"] = dict()
worldDir = experimentPath + os.sep + "worlds"
for worldConfFile in glob.glob(worldDir + os.sep + "*.yaml"):
- worldConfigObject = yaml.load(open(worldConfFile, 'r'))
+ worldConfigObject = yaml.load(open(worldConfFile, 'r'), Loader=yaml.FullLoader)
worldName = worldConfFile.split(os.sep)[-1][:-5]
experimentConf["worlds"][worldName] = worldConfigObject
diff --git a/mmlf/gui/explorer.py b/mmlf/gui/explorer.py
index 21a99e6..0f7ec84 100644
--- a/mmlf/gui/explorer.py
+++ b/mmlf/gui/explorer.py
@@ -54,9 +54,9 @@ class MMLFExplorer(QtGui.QWidget):
# Create WorldConfigEditor and load default configuration
from mmlf.gui.world_config_editor import WorldConfigEditor # must be imported lazily!s
self.worldConfigEditor = WorldConfigEditor(self, self.vlayout)
- worldConfig = yaml.load(open(mmlf.getRWPath() + os.sep + "config"
- + os.sep + "mountain_car" + os.sep
- + "world_td_lambda_exploration.yaml"))
+ worldConfig = yaml.load(open(mmlf.getRWPath() + os.sep + "config"
+ + os.sep + "mountain_car" + os.sep
+ + "world_td_lambda_exploration.yaml"), Loader=yaml.FullLoader)
# Add missing entries for the monitor to worldConfig
from mmlf.framework.monitor import Monitor
for key in Monitor.DEFAULT_CONFIG_DICT.keys():
diff --git a/mmlf/gui/world_config_editor.py b/mmlf/gui/world_config_editor.py
index e6d049c..6a3e94a 100644
--- a/mmlf/gui/world_config_editor.py
+++ b/mmlf/gui/world_config_editor.py
@@ -116,8 +116,8 @@ class WorldConfigEditor(object):
mmlf.getRWPath() + os.sep + "config",
"MMLF world config files (*.yaml)"))
if worldConfFile == "": return False # No file was selected
- worldConfig = yaml.load(open(worldConfFile, 'r'))
-
+ worldConfig = yaml.load(open(worldConfFile, 'r'), Loader=yaml.FullLoader)
+
# Add missing entries for the monitor to worldConfig
for key in Monitor.DEFAULT_CONFIG_DICT.keys():
if key not in worldConfig["monitor"]:
--
2.21.0
Loading