|
1 | 1 | import os
|
2 | 2 |
|
3 |
| - |
4 | 3 | lang_pos = {
|
5 |
| - "csharp": 1, "java": 2, "javascript": 3, |
6 |
| - "pascal": 4, "perl": 5, "python": 6, "ruby": 7, "vbnet": 8 |
| 4 | + "csharp": 1, |
| 5 | + "java": 2, |
| 6 | + "javascript": 3, |
| 7 | + "pascal": 4, |
| 8 | + "perl": 5, |
| 9 | + "python": 6, |
| 10 | + "ruby": 7, |
| 11 | + "vbnet": 8, |
7 | 12 | }
|
8 | 13 |
|
9 | 14 | write_string = "# TODO list \n game | csharp | java | javascript | pascal | perl | python | ruby | vbnet \n --- | --- | --- | --- | --- | --- | --- | --- | --- \n"
|
10 | 15 | # Set the directory you want to start from
|
11 |
| -rootDir = '..' |
| 16 | +rootDir = ".." |
12 | 17 |
|
13 | 18 | strings_done = []
|
14 | 19 |
|
15 |
| -checklist = ["game", "csharp", "java", "javascript", |
16 |
| - "pascal", "perl", "python", "ruby", "vbnet"] |
| 20 | +checklist = [ |
| 21 | + "game", |
| 22 | + "csharp", |
| 23 | + "java", |
| 24 | + "javascript", |
| 25 | + "pascal", |
| 26 | + "perl", |
| 27 | + "python", |
| 28 | + "ruby", |
| 29 | + "vbnet", |
| 30 | +] |
17 | 31 |
|
18 | 32 | prev_game = ""
|
19 | 33 |
|
20 | 34 | for dirName, subdirList, fileList in os.walk(rootDir):
|
21 | 35 | split_dir = dirName.split(os.path.sep)
|
22 | 36 |
|
23 |
| - if len(split_dir) == 2 and not split_dir[1] in ['.git', '00_Utilities']: |
| 37 | + if len(split_dir) == 2 and not split_dir[1] in [".git", "00_Utilities"]: |
24 | 38 | if prev_game == "":
|
25 | 39 | prev_game = split_dir[1]
|
26 | 40 | checklist[0] = split_dir[1]
|
27 | 41 |
|
28 | 42 | if prev_game != split_dir[1]:
|
29 | 43 | # it's a new dir
|
30 | 44 | strings_done.append(checklist)
|
31 |
| - checklist = [split_dir[1], "csharp", "java", "javascript", |
32 |
| - "pascal", "perl", "python", "ruby", "vbnet"] |
| 45 | + checklist = [ |
| 46 | + split_dir[1], |
| 47 | + "csharp", |
| 48 | + "java", |
| 49 | + "javascript", |
| 50 | + "pascal", |
| 51 | + "perl", |
| 52 | + "python", |
| 53 | + "ruby", |
| 54 | + "vbnet", |
| 55 | + ] |
33 | 56 | prev_game = split_dir[1]
|
34 | 57 |
|
35 |
| - elif len(split_dir) == 3 and split_dir[1] != '.git': |
| 58 | + elif len(split_dir) == 3 and split_dir[1] != ".git": |
36 | 59 | if split_dir[2] in lang_pos.keys():
|
37 | 60 | if len(fileList) > 1 or len(subdirList) > 0:
|
38 | 61 | # there is more files than the readme
|
|
41 | 64 | checklist[lang_pos[split_dir[2]]] = "⬜️"
|
42 | 65 |
|
43 | 66 |
|
44 |
| -sorted_strings = list(map(lambda l: " | ".join(l) + "\n", |
45 |
| - sorted(strings_done, key=lambda x: x[0]))) |
46 |
| -write_string += ''.join(sorted_strings) |
| 67 | +sorted_strings = list( |
| 68 | + map(lambda l: " | ".join(l) + "\n", sorted(strings_done, key=lambda x: x[0])) |
| 69 | +) |
| 70 | +write_string += "".join(sorted_strings) |
47 | 71 |
|
48 | 72 |
|
49 |
| -with open("README.md", "w", encoding='utf-8') as f: |
| 73 | +with open("README.md", "w", encoding="utf-8") as f: |
50 | 74 | f.write(write_string)
|
0 commit comments