def load_with_includes(filename):
with open(filename) as f:
docs = list(load_all(f))
base_dir = os.path.dirname(filename)
res = AttrDict()
for doc in docs:
if isinstance(doc, Includes):
for inc_file in doc.lst:
if not os.path.isabs(inc_file):
inc_file = os.path.join(base_dir, inc_file)
inc_res = load_with_includes(inc_file)
res._merge(inc_res)
else:
res._merge(doc)
return res
评论列表
文章目录