3def find_file_descriptions(dir_path, include_key=None):
7 for root, dirs, files
in os.walk(dir_path):
8 for f
in sorted(files):
10 f = os.path.relpath(os.path.join(root, f))
12 contents = open(f,
"r").read()
18 if include_key
is not None and include_key
not in contents:
22 for l
in contents.split(
"\n"):
24 comments.append(l[2:])
26 description =
"".
join(comments)
if comments
else "_No description available_"
27 fname = os.path.split(f)[1]
28 description =
"""## %s\n**File Location:** %s\n\n%s\n""" % (fname, f.strip(
"./"), description)
30 items.append(description)
32 return "\n".
join(items)