def __init__(self, options=[], config_path=None):
if config_path is None:
config_path = os.path.join(os.path.expanduser("~"), ".caduc", "config.yml")
if os.path.exists(config_path):
config = yaml.load(open(config_path, 'r'))
else:
config = {}
else:
config = yaml.load(open(config_path, 'r'))
super(Config, self).__init__(**config)
for opt in options:
k, v = self.parse_kv(opt)
node = {}
child = node
keys = self.parse_key(k)
for key in keys[:-1]:
child[key] = {}
child = child[key]
child[keys[-1]] = v
self.update(node)
评论列表
文章目录