diff --git a/add_categories b/irrelevant/add_categories similarity index 100% rename from add_categories rename to irrelevant/add_categories diff --git a/generate_contributions.py b/irrelevant/generate_contributions.py similarity index 100% rename from generate_contributions.py rename to irrelevant/generate_contributions.py diff --git a/generated.md b/irrelevant/generated.md similarity index 100% rename from generated.md rename to irrelevant/generated.md diff --git a/initial.md b/irrelevant/initial.md similarity index 100% rename from initial.md rename to irrelevant/initial.md diff --git a/parse_readme.py b/irrelevant/parse_readme.py similarity index 91% rename from parse_readme.py rename to irrelevant/parse_readme.py index 8e9e9eb..6cfbebb 100644 --- a/parse_readme.py +++ b/irrelevant/parse_readme.py @@ -1,4 +1,15 @@ # -*- coding: utf-8 -*- + +""" +This inefficient module would parse the README.md in the initial version of +WTFPython, and enabl me to categorize and reorder a hell lot of examples with +the help of the file `add_categories` (part of which is automatically +generated). + +After the refactor, this module would not work now with necessary updates in +the code. +""" + fname = "README.md" snippets = [] @@ -11,7 +22,6 @@ with open(fname, 'r') as f: # check if it's a H3 if line.startswith("### "): title = line.replace("### ", "") - # print(title, "found") description = [] next_line = lines.next() @@ -20,8 +30,6 @@ with open(fname, 'r') as f: description.append(next_line) next_line = lines.next() - # print("Description captured", description[:10]) - explanation = [] # store lines again until --- or another H3 is encountered while not (next_line.startswith("---") or @@ -29,9 +37,6 @@ with open(fname, 'r') as f: explanation.append(next_line) next_line = lines.next() - # print("explanation captured", explanation[:10]) - - # Store the results finally snippets.append({ "title": title, @@ -75,7 +80,6 @@ with open("add_categories", "r") as f: } content.next() except StopIteration: - print("Done!") for idx, snip in enumerate(snippets): snippets[idx]["category"] = snips_by_title[snip["title"]]["category"]