From d4212656479c7caf2d75b52de2239c41e0a4f87f Mon Sep 17 00:00:00 2001 From: Tim Miller Date: Mon, 28 Jan 2013 23:47:43 -0800 Subject: [PATCH] Add comments. --- cornfig/cornfig.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cornfig/cornfig.py b/cornfig/cornfig.py index f071c30..72f4781 100644 --- a/cornfig/cornfig.py +++ b/cornfig/cornfig.py @@ -22,6 +22,7 @@ def write_file(path, contents): out.write(contents) out.close() +# return a map of filenames->filecontents def build_tree(templates, config): res = {} for in_file, out_file in templates: @@ -50,6 +51,8 @@ def render_executable(path, config): def read_config(path): return json.loads(open(path).read()) +# flatten a nested hash into a one-level hash +# {x: {a: b} } => {x.a: b} def flatten(d, prefix='', res=None): res = res or {} for k, v in d.items():