Skip to content

Commit 65a0811

Browse files
committed
A bit of code clean up
1 parent 5027698 commit 65a0811

File tree

5 files changed

+11
-7
lines changed

5 files changed

+11
-7
lines changed
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

parse_readme.py renamed to irrelevant/parse_readme.py

+11-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
11
# -*- coding: utf-8 -*-
2+
3+
"""
4+
This inefficient module would parse the README.md in the initial version of
5+
WTFPython, and enabl me to categorize and reorder a hell lot of examples with
6+
the help of the file `add_categories` (part of which is automatically
7+
generated).
8+
9+
After the refactor, this module would not work now with necessary updates in
10+
the code.
11+
"""
12+
213
fname = "README.md"
314
snippets = []
415

@@ -11,7 +22,6 @@
1122
# check if it's a H3
1223
if line.startswith("### "):
1324
title = line.replace("### ", "")
14-
# print(title, "found")
1525
description = []
1626
next_line = lines.next()
1727

@@ -20,18 +30,13 @@
2030
description.append(next_line)
2131
next_line = lines.next()
2232

23-
# print("Description captured", description[:10])
24-
2533
explanation = []
2634
# store lines again until --- or another H3 is encountered
2735
while not (next_line.startswith("---") or
2836
next_line.startswith("### ")):
2937
explanation.append(next_line)
3038
next_line = lines.next()
3139

32-
# print("explanation captured", explanation[:10])
33-
34-
3540
# Store the results finally
3641
snippets.append({
3742
"title": title,
@@ -75,7 +80,6 @@
7580
}
7681
content.next()
7782
except StopIteration:
78-
print("Done!")
7983

8084
for idx, snip in enumerate(snippets):
8185
snippets[idx]["category"] = snips_by_title[snip["title"]]["category"]

0 commit comments

Comments
 (0)