aboutsummaryrefslogtreecommitdiffstats
path: root/fg21sim/configs
diff options
context:
space:
mode:
authorAaron LI <aly@aaronly.me>2017-10-24 23:18:45 +0800
committerAaron LI <aly@aaronly.me>2017-10-24 23:21:42 +0800
commita69e0a27fe1615f38e6a37e8b494fe8f7e542d8d (patch)
treeccb7a126f419decb7cf004b068ddf4f99eaa9bc0 /fg21sim/configs
parent56f662057317331a59cfee37b0b7005dc2913bb0 (diff)
downloadfg21sim-a69e0a27fe1615f38e6a37e8b494fe8f7e542d8d.tar.bz2
configs: add __getitem__() and __setitem__() methods
Diffstat (limited to 'fg21sim/configs')
-rw-r--r--fg21sim/configs/manager.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/fg21sim/configs/manager.py b/fg21sim/configs/manager.py
index 4143a8f..7912e1d 100644
--- a/fg21sim/configs/manager.py
+++ b/fg21sim/configs/manager.py
@@ -233,7 +233,8 @@ class ConfigManager:
logger.info("Loaded user config: {0}".format(self.userconfig))
def reset(self):
- """Reset the current configurations to the copy of defaults from
+ """
+ Reset the current configurations to the copy of defaults from
the specifications.
NOTE: Also reset ``self.userconfig`` to ``None``.
@@ -423,6 +424,12 @@ class ConfigManager:
logger.info("Set config: {key}: {val_new} <- {val_old}".format(
key="/".join(key), val_new=val_new, val_old=val_old))
+ def __getitem__(self, key):
+ return self.getn(key=key)
+
+ def __setitem__(self, key, value):
+ self.setn(key=key, value=value)
+
def get_path(self, key):
"""
Return the absolute path of the file/directory specified by the