[Yt-svn] yt: Adding a __setitem__ method to ytcfg
hg at spacepope.org
hg at spacepope.org
Wed Nov 24 03:00:15 PST 2010
hg Repository: yt
details: yt/rev/19e3e5f1c0b9
changeset: 3559:19e3e5f1c0b9
user: Matthew Turk <matthewturk at gmail.com>
date:
Wed Nov 24 06:00:08 2010 -0500
description:
Adding a __setitem__ method to ytcfg
diffstat:
yt/config.py | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diffs (21 lines):
diff -r c8a955052039 -r 19e3e5f1c0b9 yt/config.py
--- a/yt/config.py Wed Nov 24 02:12:57 2010 -0700
+++ b/yt/config.py Wed Nov 24 06:00:08 2010 -0500
@@ -80,11 +80,15 @@
# new_cp = Configparser.ConfigParser(ytcfgDefaults)
# new_cp.write(__fn)
+class YTConfigParser(ConfigParser.ConfigParser):
+ def __setitem__(self, key, val):
+ self.set(key[0], key[1], val)
+
if os.path.exists(os.path.expanduser("~/.yt/config")):
- ytcfg = ConfigParser.ConfigParser(ytcfgDefaults)
+ ytcfg = YTConfigParser(ytcfgDefaults)
ytcfg.read(['yt.cfg', os.path.expanduser('~/.yt/config')])
else:
- ytcfg = ConfigParser.ConfigParser(ytcfgDefaults)
+ ytcfg = YTConfigParser(ytcfgDefaults)
ytcfg.read(['yt.cfg'])
if not ytcfg.has_section("yt"):
ytcfg.add_section("yt")
More information about the yt-svn
mailing list