15
15
16
16
17
17
def main ():
18
+ """
19
+ The main drop in script for the README generation.
20
+ """
18
21
ssl ._create_default_https_context = ssl ._create_unverified_context
19
22
args = _get_args ()
20
23
numeric_level = getattr (logging , args [1 ].upper (), None )
@@ -31,6 +34,7 @@ def _get_args() -> tuple:
31
34
"""
32
35
A helper function which gets the log level from
33
36
the command line. Set as warning from default.
37
+
34
38
:return: the log level provided by the user
35
39
"""
36
40
parser = argparse .ArgumentParser ()
@@ -49,6 +53,12 @@ def _get_args() -> tuple:
49
53
50
54
51
55
def _get_intro_text (language : LanguageCollection ) -> Paragraph :
56
+ """
57
+ Generates the test for the introduction of the README.
58
+
59
+ :param language: the language to generate from the LanguageCollection
60
+ :return: the introduction paragraph in the README
61
+ """
52
62
paragraph = Paragraph ([f"Welcome to Sample Programs in { language } ! " ])
53
63
text = Inline ("here." , link = language .lang_docs_url ())
54
64
if language .has_docs :
@@ -60,6 +70,7 @@ def _get_intro_text(language: LanguageCollection) -> Paragraph:
60
70
def _generate_program_list (language : LanguageCollection ) -> list :
61
71
"""
62
72
A helper function which generates a list of programs for the README.
73
+
63
74
:param language: a language collection
64
75
:return: a list of sample programs list items
65
76
"""
@@ -76,8 +87,15 @@ def _generate_program_list(language: LanguageCollection) -> list:
76
87
return list_items
77
88
78
89
79
- def _generate_missing_program_list (language : LanguageCollection , missing_programs : list [str ]):
80
- list_items = list ()
90
+ def _generate_missing_program_list (language : LanguageCollection , missing_programs : list [str ]) -> list [Paragraph ]:
91
+ """
92
+ Generates the list of programs that are missing in Markdown.
93
+
94
+ :param language: the language with missing programs
95
+ :param missing_programs: the list of programs missing from the language collection
96
+ :return: the missing programs lines as Markdown strings
97
+ """
98
+ list_items : list [Paragraph ] = list ()
81
99
missing_programs .sort (key = lambda x : x .name ())
82
100
for program in missing_programs :
83
101
program : Project
@@ -106,15 +124,22 @@ def _generate_credit() -> Paragraph:
106
124
return p
107
125
108
126
109
- def _generate_program_list_header (program_count : int , total_program_count : int ):
127
+ def _generate_program_list_header (program_count : int , total_program_count : int ) -> str :
128
+ """
129
+ Creates the heading test for the programs list.
130
+
131
+ :param program_count: the number of programs completed in the language
132
+ :param total_program_count: the total number of possible programs
133
+ :return: the heading about the program list
134
+ """
110
135
i = int (((program_count / total_program_count ) * 4 ))
111
136
emojis = [":disappointed:" , ":thinking:" , ":relaxed:" , ":smile:" , ":partying_face:" ]
112
137
return f"Sample Programs List - { program_count } /{ total_program_count } { emojis [i ]} "
113
138
114
139
115
140
class ReadMeCatalog :
116
141
"""
117
- An representation of the collection of READMEs in the Sample Programs repo.
142
+ A representation of the collection of READMEs in the Sample Programs repo.
118
143
"""
119
144
120
145
def __init__ (self , repo : Repo ):
0 commit comments